[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_plugins/src/View/Plugins/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_plugins
   6   *
   7   * @copyright   (C) 2007 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\Plugins\Administrator\View\Plugins;
  12  
  13  use Joomla\CMS\Helper\ContentHelper;
  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\Toolbar\Toolbar;
  18  use Joomla\CMS\Toolbar\ToolbarHelper;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('_JEXEC') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * View class for a list of plugins.
  26   *
  27   * @since  1.5
  28   */
  29  class HtmlView extends BaseHtmlView
  30  {
  31      /**
  32       * An array of items
  33       *
  34       * @var  array
  35       */
  36      protected $items;
  37  
  38      /**
  39       * The pagination object
  40       *
  41       * @var    \Joomla\CMS\Pagination\Pagination
  42       */
  43      protected $pagination;
  44  
  45      /**
  46       * The model state
  47       *
  48       * @var   \Joomla\CMS\Object\CMSObject
  49       */
  50      protected $state;
  51  
  52      /**
  53       * Form object for search filters
  54       *
  55       * @var    \Joomla\CMS\Form\Form
  56       * @since  4.0.0
  57       */
  58      public $filterForm;
  59  
  60      /**
  61       * The active search filters
  62       *
  63       * @var    array
  64       * @since  4.0.0
  65       */
  66      public $activeFilters;
  67  
  68      /**
  69       * Display the view.
  70       *
  71       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  72       *
  73       * @return  void
  74       */
  75      public function display($tpl = null)
  76      {
  77          $this->items = $this->get('Items');
  78          $this->pagination = $this->get('Pagination');
  79          $this->state = $this->get('State');
  80          $this->filterForm = $this->get('FilterForm');
  81          $this->activeFilters = $this->get('ActiveFilters');
  82  
  83          // Check for errors.
  84          if (count($errors = $this->get('Errors'))) {
  85              throw new GenericDataException(implode("\n", $errors), 500);
  86          }
  87  
  88          $this->addToolbar();
  89  
  90          parent::display($tpl);
  91      }
  92  
  93      /**
  94       * Add the page title and toolbar.
  95       *
  96       * @return  void
  97       *
  98       * @since   1.6
  99       */
 100      protected function addToolbar()
 101      {
 102          $canDo = ContentHelper::getActions('com_plugins');
 103  
 104          ToolbarHelper::title(Text::_('COM_PLUGINS_MANAGER_PLUGINS'), 'plug plugin');
 105  
 106          // Get the toolbar object instance
 107          $toolbar = Toolbar::getInstance('toolbar');
 108  
 109          if ($canDo->get('core.edit.state')) {
 110              $toolbar->publish('plugins.publish', 'JTOOLBAR_ENABLE')->listCheck(true);
 111              $toolbar->unpublish('plugins.unpublish', 'JTOOLBAR_DISABLE')->listCheck(true);
 112              $toolbar->checkin('plugins.checkin')->listCheck(true);
 113          }
 114  
 115          if ($canDo->get('core.admin')) {
 116              $toolbar->preferences('com_plugins');
 117          }
 118  
 119          $toolbar->help('Plugins');
 120      }
 121  }


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