[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_config/src/View/Config/ -> HtmlView.php (source)

   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\Config;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  15  use Joomla\Component\Config\Administrator\Controller\RequestController;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * View for the global configuration
  23   *
  24   * @since  3.2
  25   */
  26  class HtmlView extends BaseHtmlView
  27  {
  28      /**
  29       * The form object
  30       *
  31       * @var   \Joomla\CMS\Form\Form
  32       *
  33       * @since 3.2
  34       */
  35      public $form;
  36  
  37      /**
  38       * The data to be displayed in the form
  39       *
  40       * @var   array
  41       *
  42       * @since 3.2
  43       */
  44      public $data;
  45  
  46      /**
  47       * Is the current user a super administrator?
  48       *
  49       * @var   boolean
  50       *
  51       * @since 3.2
  52       */
  53      protected $userIsSuperAdmin;
  54  
  55      /**
  56       * The page class suffix
  57       *
  58       * @var    string
  59       *
  60       * @since  4.0.0
  61       */
  62      protected $pageclass_sfx = '';
  63  
  64      /**
  65       * The page parameters
  66       *
  67       * @var    \Joomla\Registry\Registry|null
  68       *
  69       * @since  4.0.0
  70       */
  71      protected $params = null;
  72  
  73      /**
  74       * Execute and display a template script.
  75       *
  76       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  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          // Access backend com_config
  88          $requestController = new RequestController();
  89  
  90          // Execute backend controller
  91          $serviceData = json_decode($requestController->getJson(), true);
  92  
  93          $form = $this->getForm();
  94  
  95          if ($form) {
  96              $form->bind($serviceData);
  97          }
  98  
  99          $this->form = $form;
 100          $this->data = $serviceData;
 101  
 102          $this->_prepareDocument();
 103  
 104          parent::display($tpl);
 105      }
 106  
 107      /**
 108       * Prepares the document.
 109       *
 110       * @return  void
 111       *
 112       * @since   4.0.0
 113       */
 114      protected function _prepareDocument()
 115      {
 116          $params = Factory::getApplication()->getParams();
 117  
 118          // Because the application sets a default page title, we need to get it
 119          // right from the menu item itself
 120  
 121          $this->setDocumentTitle($params->get('page_title', ''));
 122  
 123          if ($params->get('menu-meta_description')) {
 124              $this->document->setDescription($params->get('menu-meta_description'));
 125          }
 126  
 127          if ($params->get('robots')) {
 128              $this->document->setMetaData('robots', $params->get('robots'));
 129          }
 130  
 131          // Escape strings for HTML output
 132          $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', ''));
 133          $this->params        = &$params;
 134      }
 135  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer