[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_users/src/View/Remind/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_users
   6   *
   7   * @copyright   (C) 2009 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\Users\Site\View\Remind;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\MVC\View\GenericDataException;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Object\CMSObject;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * Remind view class for Users.
  25   *
  26   * @since  1.5
  27   */
  28  class HtmlView extends BaseHtmlView
  29  {
  30      /**
  31       * The Form object
  32       *
  33       * @var  \Joomla\CMS\Form\Form
  34       */
  35      protected $form;
  36  
  37      /**
  38       * The page parameters
  39       *
  40       * @var  \Joomla\Registry\Registry|null
  41       */
  42      protected $params;
  43  
  44      /**
  45       * The model state
  46       *
  47       * @var  CMSObject
  48       */
  49      protected $state;
  50  
  51      /**
  52       * The page class suffix
  53       *
  54       * @var    string
  55       * @since  4.0.0
  56       */
  57      protected $pageclass_sfx = '';
  58  
  59      /**
  60       * Method to display the view.
  61       *
  62       * @param   string  $tpl  The template file to include
  63       *
  64       * @return  mixed
  65       *
  66       * @since   1.5
  67       * @throws  \Exception
  68       */
  69      public function display($tpl = null)
  70      {
  71          // Get the view data.
  72          $this->form   = $this->get('Form');
  73          $this->state  = $this->get('State');
  74          $this->params = $this->state->params;
  75  
  76          // Check for errors.
  77          if (count($errors = $this->get('Errors'))) {
  78              throw new GenericDataException(implode("\n", $errors), 500);
  79          }
  80  
  81          // Check for layout override
  82          $active = Factory::getApplication()->getMenu()->getActive();
  83  
  84          if (isset($active->query['layout'])) {
  85              $this->setLayout($active->query['layout']);
  86          }
  87  
  88          // Escape strings for HTML output
  89          $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8');
  90  
  91          $this->prepareDocument();
  92  
  93          parent::display($tpl);
  94      }
  95  
  96      /**
  97       * Prepares the document.
  98       *
  99       * @return  void
 100       *
 101       * @since   1.6
 102       * @throws  \Exception
 103       */
 104      protected function prepareDocument()
 105      {
 106          // Because the application sets a default page title,
 107          // we need to get it from the menu item itself
 108          $menu = Factory::getApplication()->getMenu()->getActive();
 109  
 110          if ($menu) {
 111              $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
 112          } else {
 113              $this->params->def('page_heading', Text::_('COM_USERS_REMIND'));
 114          }
 115  
 116          $this->setDocumentTitle($this->params->get('page_title', ''));
 117  
 118          if ($this->params->get('menu-meta_description')) {
 119              $this->document->setDescription($this->params->get('menu-meta_description'));
 120          }
 121  
 122          if ($this->params->get('robots')) {
 123              $this->document->setMetaData('robots', $this->params->get('robots'));
 124          }
 125      }
 126  }


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