Skip to content

Commit 13bf706

Browse files
committed
Fix front end editing of configuration
1 parent 63c25c1 commit 13bf706

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

administrator/components/com_templates/Controller/StyleController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function save($key = null, $urlVar = null)
4949
if ($document->getType() === 'json')
5050
{
5151
$app = \JFactory::getApplication();
52-
$model = $this->getModel();
52+
$model = $this->getModel('Style', 'Administrator');
5353
$table = $model->getTable();
5454
$data = $this->input->post->get('params', array(), 'array');
5555
$checkin = property_exists($table, 'checked_out');
@@ -73,7 +73,7 @@ public function save($key = null, $urlVar = null)
7373
return false;
7474
}
7575

76-
\JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_templates/models/forms');
76+
\JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_templates/forms');
7777

7878
// Validate the posted data.
7979
// Sometimes the form needs some posted data, such as for plugins and modules.

components/com_config/Controller/ConfigController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function save()
8080
// Set FTP credentials, if given.
8181
\JClientHelper::setCredentialsFromRequest('ftp');
8282

83-
$model = new \Joomla\Component\Config\Site\Model\ConfigModel;
83+
$model = $this->getModel();
8484

8585
$form = $model->getForm();
8686
$data = $this->app->input->post->get('jform', array(), 'array');
@@ -106,11 +106,10 @@ public function save()
106106
$data = $return;
107107

108108
// Access backend com_config
109-
\JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config');
110-
$saveClass = new \Joomla\Component\Config\Administrator\Controller\ApplicationController;
109+
$saveClass = $this->factory->createController('Application', 'Administrator');
111110

112111
// Get a document object
113-
$document = \JFactory::getDocument();
112+
$document = $this->app->getDocument();
114113

115114
// Set backend required params
116115
$document->setType('json');

components/com_config/Controller/TemplatesController.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,10 @@ public function save()
8787
$app = $this->app;
8888

8989
// Access backend com_templates
90-
\JLoader::register('TemplatesControllerStyle', JPATH_ADMINISTRATOR . '/components/com_templates/controllers/style.php');
91-
\JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR . '/components/com_templates/models/style.php');
92-
\JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR . '/components/com_templates/tables/style.php');
93-
$controllerClass = new StyleController;
90+
$controllerClass = $app->bootComponent('com_templates')->createMVCFactory($app)->createController('Style', 'Administrator');
9491

9592
// Get a document object
96-
$document = \JFactory::getDocument();
93+
$document = $app->getDocument();
9794

9895
// Set backend required params
9996
$document->setType('json');
@@ -123,8 +120,10 @@ public function save()
123120
// Set the success message.
124121
$message = \JText::_('COM_CONFIG_SAVE_SUCCESS');
125122

123+
$this->setMessage($message);
124+
126125
// Redirect back to com_config display
127-
$app->redirect(\JRoute::_('index.php?option=com_config&view=templates', false), $message);
126+
$this->redirect(\JRoute::_('index.php?option=com_config&view=templates', false));
128127

129128
return true;
130129
}

components/com_config/tmpl/config/default.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
defined('_JEXEC') or die;
1111

12+
use Joomla\CMS\HTML\HTMLHelper;
13+
1214
// Load tooltips behavior
1315
JHtml::_('behavior.formvalidator');
16+
HTMLHelper::_('script', 'com_config/config-default.js', ['relative' => true, 'version' => 'auto']);
1417
?>
1518

1619
<form action="<?php echo JRoute::_('index.php?option=com_config'); ?>" id="application-form" method="post" name="adminForm" class="form-validate" data-cancel-task="config.cancel.component">

0 commit comments

Comments
 (0)