- md5
- 7762fe5f2728717f3e313b0a251993eb
- sha1
- 0fab0e74522e72239326a76200c70a716ea58f2e
- sha256
- 436c9e3ed4653a12f4bc89aa61b394f2337fa54b9a16b803e94f8477de94228b
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
<?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\Templates;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Factory\MVCFactory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\Component\Config\Administrator\Controller\RequestController;
use Joomla\Component\Templates\Administrator\View\Style\JsonView;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* View to edit a template style.
*
* @since 3.2
*/
class HtmlView extends BaseHtmlView
{
/**
* The data to be displayed in the form
*
* @var array
*
* @since 3.2
*/
public $item;
/**
* The form object
*
* @var Form
*
* @since 3.2
*/
public $form;
/**
* Is the current user a super administrator?
*
* @var boolean
*
* @since 3.2
*/
protected $userIsSuperAdmin;
/**
* The page class suffix
*
* @var string
*
* @since 4.0.0
*/
protected $pageclass_sfx = '';
/**
* The page parameters
*
* @var \Joomla\Registry\Registry|null
*
* @since 4.0.0
*/
protected $params = null;
/**
* Method to render the view.
*
* @return void
*
* @since 3.2
*/
public function display($tpl = null)
{
$user = $this->getCurrentUser();
$this->userIsSuperAdmin = $user->authorise('core.admin');
$app = Factory::getApplication();
$app->getInput()->set('id', $app->getTemplate(true)->id);
/** @var MVCFactory $factory */
$factory = $app->bootComponent('com_templates')->getMVCFactory();
/** @var JsonView $view */
$view = $factory->createView('Style', 'Administrator', 'Json');
$view->setModel($factory->createModel('Style', 'Administrator'), true);
$view->setLanguage($app->getLanguage());
$view->document = $this->getDocument();
$json = $view->display();
// Execute backend controller
$serviceData = json_decode($json, true);
// Access backend com_config
$requestController = new RequestController();
// Execute backend controller
$configData = json_decode($requestController->getJson(), true);
$data = array_merge($configData, $serviceData);
/** @var Form $form */
$form = $this->getForm();
if ($form) {
$form->bind($data);
// Add form control fields
$form->addControlField('task');
}
$this->form = $form;
$this->data = $serviceData;
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @return void
*
* @since 4.0.0
*/
protected function _prepareDocument()
{
$params = Factory::getApplication()->getParams();
// Because the application sets a default page title, we need to get it
// right from the menu item itself
$this->setDocumentTitle($params->get('page_title', ''));
if ($params->get('menu-meta_description')) {
$this->getDocument()->setDescription($params->get('menu-meta_description'));
}
if ($params->get('robots')) {
$this->getDocument()->setMetaData('robots', $params->get('robots'));
}
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = &$params;
}
}
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.