[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_privacy/src/View/Capabilities/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_privacy
   6   *
   7   * @copyright   (C) 2018 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\Privacy\Administrator\View\Capabilities;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\MVC\View\GenericDataException;
  15  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  16  use Joomla\CMS\Object\CMSObject;
  17  use Joomla\CMS\Toolbar\ToolbarHelper;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * Capabilities view class
  25   *
  26   * @since  3.9.0
  27   */
  28  class HtmlView extends BaseHtmlView
  29  {
  30      /**
  31       * The reported extension capabilities
  32       *
  33       * @var    array
  34       * @since  3.9.0
  35       */
  36      protected $capabilities;
  37  
  38      /**
  39       * The state information
  40       *
  41       * @var    CMSObject
  42       * @since  3.9.0
  43       */
  44      protected $state;
  45  
  46      /**
  47       * Execute and display a template script.
  48       *
  49       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  50       *
  51       * @return  void
  52       *
  53       * @see     BaseHtmlView::loadTemplate()
  54       * @since   3.9.0
  55       * @throws  \Exception
  56       */
  57      public function display($tpl = null)
  58      {
  59          // Initialise variables
  60          $this->capabilities = $this->get('Capabilities');
  61          $this->state        = $this->get('State');
  62  
  63          // Check for errors.
  64          if (count($errors = $this->get('Errors'))) {
  65              throw new Genericdataexception(implode("\n", $errors), 500);
  66          }
  67  
  68          $this->addToolbar();
  69  
  70          parent::display($tpl);
  71      }
  72  
  73      /**
  74       * Add the page title and toolbar.
  75       *
  76       * @return  void
  77       *
  78       * @since   3.9.0
  79       */
  80      protected function addToolbar()
  81      {
  82          ToolbarHelper::title(Text::_('COM_PRIVACY_VIEW_CAPABILITIES'), 'lock');
  83  
  84          ToolbarHelper::preferences('com_privacy');
  85  
  86          ToolbarHelper::help('Privacy:_Extension_Capabilities');
  87      }
  88  }


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