[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_installer/src/View/Discover/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2008 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\Installer\Administrator\View\Discover;
  12  
  13  use Joomla\CMS\MVC\View\GenericDataException;
  14  use Joomla\CMS\Toolbar\ToolbarHelper;
  15  use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Extension Manager Discover View
  23   *
  24   * @since  1.6
  25   */
  26  class HtmlView extends InstallerViewDefault
  27  {
  28      /**
  29       * Is this view an Empty State
  30       *
  31       * @var  boolean
  32       * @since 4.0.0
  33       */
  34      private $isEmptyState = false;
  35  
  36      /**
  37       * Display the view.
  38       *
  39       * @param   string  $tpl  Template
  40       *
  41       * @return  void
  42       *
  43       * @since   1.6
  44       */
  45      public function display($tpl = null)
  46      {
  47          // Run discover from the model.
  48          if (!$this->getModel()->checkExtensions()) {
  49              $this->getModel()->discover();
  50          }
  51  
  52          // Get data from the model.
  53          $this->items         = $this->get('Items');
  54          $this->pagination    = $this->get('Pagination');
  55          $this->filterForm    = $this->get('FilterForm');
  56          $this->activeFilters = $this->get('ActiveFilters');
  57  
  58          if (!count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
  59              $this->setLayout('emptystate');
  60          }
  61  
  62          // Check for errors.
  63          if (count($errors = $this->get('Errors'))) {
  64              throw new GenericDataException(implode("\n", $errors), 500);
  65          }
  66  
  67          parent::display($tpl);
  68      }
  69  
  70      /**
  71       * Add the page title and toolbar.
  72       *
  73       * @return  void
  74       *
  75       * @since   3.1
  76       */
  77      protected function addToolbar()
  78      {
  79          /*
  80           * Set toolbar items for the page.
  81           */
  82          if (!$this->isEmptyState) {
  83              ToolbarHelper::custom('discover.install', 'upload', '', 'JTOOLBAR_INSTALL', true);
  84          }
  85  
  86          ToolbarHelper::custom('discover.refresh', 'refresh', '', 'COM_INSTALLER_TOOLBAR_DISCOVER', false);
  87          ToolbarHelper::divider();
  88  
  89          parent::addToolbar();
  90  
  91          ToolbarHelper::help('Extensions:_Discover');
  92      }
  93  }


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