- md5
- 7dfaadfb5548f95de07ccf9f8f2d8049
- sha1
- a300a7fd41ed73b8229823d579ded3e24a049796
- sha256
- e8a591731dc1dda3a32f78641e746942a73db7e1d22a93057f3758945d0cb3e6
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Config\Site\View\Modules;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\Component\Config\Site\Model\ModulesModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* View to edit a module.
*
* @since 3.2
*/
class HtmlView extends BaseHtmlView
{
/**
* The module to be rendered
*
* @var array
*
* @since 3.2
*/
public $item;
/**
* The form object
*
* @var Form
*
* @since 3.2
*/
public $form;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 3.2
*/
public function display($tpl = null)
{
$lang = Factory::getApplication()->getLanguage();
$lang->load('', JPATH_ADMINISTRATOR, $lang->getTag());
$lang->load('com_modules', JPATH_ADMINISTRATOR, $lang->getTag());
// @todo Move and clean up
$module = (new \Joomla\Component\Modules\Administrator\Model\ModuleModel())->getItem(Factory::getApplication()->getInput()->getInt('id'));
$moduleData = get_object_vars($module);
unset($moduleData['xml']);
/** @var \Joomla\Component\Config\Site\Model\ModulesModel $model */
$model = $this->getModel();
// Need to add module name to the state of model
$model->getState()->set('module.name', $moduleData['module']);
/** @var ModulesModel $model */
$model = $this->getModel();
$this->form = $model->getForm();
$this->positions = $model->getPositions();
$this->item = $moduleData;
if ($this->form) {
$this->form->bind($moduleData);
// Add form control fields
$this->form
->addControlField('task')
->addControlField('return', Factory::getApplication()->getInput()->get('return', null, 'base64'))
->addControlField('id', $this->item['id']);
}
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 4.0.0
*/
protected function _prepareDocument()
{
// There is no menu item for this so we have to use the title from the component
$this->setDocumentTitle(Text::_('COM_CONFIG_MODULES_SETTINGS_TITLE'));
}
}
The same content is in 29 releases, Joomla 6.1.0-alpha3 to 6.2.1-rc1. See them all, or every version of this file.