[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage com_config 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Config\Site\View\Templates; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Form\Form; 15 use Joomla\CMS\MVC\Factory\MVCFactory; 16 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 17 use Joomla\Component\Config\Administrator\Controller\RequestController; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * View to edit a template style. 25 * 26 * @since 3.2 27 */ 28 class HtmlView extends BaseHtmlView 29 { 30 /** 31 * The data to be displayed in the form 32 * 33 * @var array 34 * 35 * @since 3.2 36 */ 37 public $item; 38 39 /** 40 * The form object 41 * 42 * @var Form 43 * 44 * @since 3.2 45 */ 46 public $form; 47 48 /** 49 * Is the current user a super administrator? 50 * 51 * @var boolean 52 * 53 * @since 3.2 54 */ 55 protected $userIsSuperAdmin; 56 57 /** 58 * The page class suffix 59 * 60 * @var string 61 * 62 * @since 4.0.0 63 */ 64 protected $pageclass_sfx = ''; 65 66 /** 67 * The page parameters 68 * 69 * @var \Joomla\Registry\Registry|null 70 * 71 * @since 4.0.0 72 */ 73 protected $params = null; 74 75 /** 76 * Method to render the view. 77 * 78 * @return void 79 * 80 * @since 3.2 81 */ 82 public function display($tpl = null) 83 { 84 $user = $this->getCurrentUser(); 85 $this->userIsSuperAdmin = $user->authorise('core.admin'); 86 87 $app = Factory::getApplication(); 88 89 $app->input->set('id', $app->getTemplate(true)->id); 90 91 /** @var MVCFactory $factory */ 92 $factory = $app->bootComponent('com_templates')->getMVCFactory(); 93 94 $view = $factory->createView('Style', 'Administrator', 'Json'); 95 $view->setModel($factory->createModel('Style', 'Administrator'), true); 96 97 $view->document = $this->document; 98 99 $json = $view->display(); 100 101 // Execute backend controller 102 $serviceData = json_decode($json, true); 103 104 // Access backend com_config 105 $requestController = new RequestController(); 106 107 // Execute backend controller 108 $configData = json_decode($requestController->getJson(), true); 109 110 $data = array_merge($configData, $serviceData); 111 112 /** @var Form $form */ 113 $form = $this->getForm(); 114 115 if ($form) { 116 $form->bind($data); 117 } 118 119 $this->form = $form; 120 121 $this->data = $serviceData; 122 123 $this->_prepareDocument(); 124 125 parent::display($tpl); 126 } 127 128 /** 129 * Prepares the document. 130 * 131 * @return void 132 * 133 * @since 4.0.0 134 */ 135 protected function _prepareDocument() 136 { 137 $params = Factory::getApplication()->getParams(); 138 139 // Because the application sets a default page title, we need to get it 140 // right from the menu item itself 141 $this->setDocumentTitle($params->get('page_title', '')); 142 143 if ($params->get('menu-meta_description')) { 144 $this->document->setDescription($params->get('menu-meta_description')); 145 } 146 147 if ($params->get('robots')) { 148 $this->document->setMetaData('robots', $params->get('robots')); 149 } 150 151 // Escape strings for HTML output 152 $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', '')); 153 $this->params = &$params; 154 } 155 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |