CoreFiles by mySites.guru
HtmlView.php96 lines, 2,383 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
7b500dfbe7f2eccefa6d21ffefaad4f4
sha1
d44344378315232ac906014a2519d9d56bbba7fa
sha256
77a66f30c34d32546203f4cc27eca908e6c70e5fdaa3860cdac967484cdb1a83
<?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;

/**
 * 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()->input->getInt('id'));

        $moduleData = $module->getProperties();
        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 Form form */
        $this->form      = $this->get('form');
        $this->positions = $this->get('positions');
        $this->item      = $moduleData;

        if ($this->form) {
            $this->form->bind($moduleData);
        }

        $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 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.