Skip to content

Commit

Permalink
[2.5.18] Fix issue Hide title (and all options)- is changed unintenti…
Browse files Browse the repository at this point in the history
…onally when saving in the frontend
  • Loading branch information
sonvnn committed Aug 22, 2022
1 parent f61fc27 commit 72fa0cd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
19 changes: 19 additions & 0 deletions framework/library/astroid/Helper/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Astroid\Framework;
use Astroid\Helper;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;

defined('_JEXEC') or die;

Expand Down Expand Up @@ -229,4 +230,22 @@ public function onContentPrepareForm($form, &$data)
');
}
}

public function onContentBeforeSave($context, $table, $isNew, $data)
{
if ($context === 'com_content.form' && Framework::isSite() && !$isNew) {
$tblClone = clone($table);

$tblClone -> reset();
$tblClone -> load($table -> get($table -> getKeyName()));

$params = new Registry($tblClone -> get('attribs'));

$my_attribs = new Registry($data['attribs']);
$params -> merge($my_attribs);

$table -> set('attribs', $params -> toString());
}
return true;
}
}
11 changes: 10 additions & 1 deletion plugins/astroid/astroid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package Astroid Framework
* @author TemPlaza https://www.templaza.com
* @copyright Copyright (C) 2011 - 2021 TemPlaza.
* @copyright Copyright (C) 2011 - 2022 TemPlaza.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3 or Later
*/
/**
Expand Down Expand Up @@ -54,6 +54,15 @@ public function onContentPrepareForm($form, $data)
Framework::getClient()->onContentPrepareForm($form, $data);
}

public function onContentBeforeSave($context, $table, $isNew, $data)
{
if (!file_exists(JPATH_LIBRARIES . '/astroid/framework/library/astroid')) {
return false;
}

return Framework::getClient()->onContentBeforeSave($context, $table, $isNew, $data);
}

public function onAfterRender()
{
if (!file_exists(JPATH_LIBRARIES . '/astroid/framework/library/astroid')) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/astroid/astroid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<extension version="3.1" type="plugin" method="upgrade" group="system">
<name>Astroid Plugin</name>
<author>JoomDev/TemPlaza</author>
<creationDate>April 2022</creationDate>
<version>2.5.16</version>
<creationDate>August 2022</creationDate>
<version>2.5.19</version>
<url>https://www.astroidframe.work</url>
<copyright>Copyright (C) 2022 TemPlaza, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
Expand Down

0 comments on commit 72fa0cd

Please sign in to comment.