/** * Edit the component parameters */ public function edit($key = null, $urlVar = null) { // Access check. if (!JFactory::getUser()->authorise('core.admin', 'com_attachments')) { return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 117)'); } // Get the component parameters jimport('joomla.application.component.helper'); $params = JComponentHelper::getParams('com_attachments'); // Get the component model/table $model = new ConfigModelComponent(); $state = $model->getState(); $state->set('component.option', 'com_attachments'); $state->set('component.path', JPATH_ADMINISTRATOR . '/components/com_attachments'); $model->setState($state); $form = $model->getForm(); $component = JComponentHelper::getComponent('com_attachments'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors) . ' (ERR 118)'); return false; } // Bind the form to the data. if ($form && $component->params) { $form->bind($component->params); } // Set up the view require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/params/view.html.php'; $view = new AttachmentsViewParams(); $view->setModel($model); $view->params = $params; $view->form = $form; $view->component = $component; $view->display(); }
/** * Instantiates a new component configuration model * from Joomla! own com_config * * @param string $component name of component for which the model should be initialized * @param string $path path to a folder where config xml file can be found * @return ConfigModelComponent */ public static function getComConfigComponentModel($component = 'com_sh404sef', $path = '') { require_once JPATH_ROOT . '/administrator/components/com_config/models/component.php'; $comConfigModel = new ConfigModelComponent(array('ignore_request' => true)); $comConfigModel->setState('component.option', $component); if (!empty($path)) { $comConfigModel->setState('component.path', $path); } return $comConfigModel; }