[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_contenthistory/src/View/Preview/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_contenthistory
   6   *
   7   * @copyright   (C) 2013 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\Contenthistory\Administrator\View\Preview;
  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  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('_JEXEC') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * View class for a list of contenthistory.
  24   *
  25   * @since  1.5
  26   */
  27  class HtmlView extends BaseHtmlView
  28  {
  29      /**
  30       * An array of items
  31       *
  32       * @var  \stdClass|false
  33       */
  34      protected $item;
  35  
  36      /**
  37       * The model state
  38       *
  39       * @var  \Joomla\CMS\Object\CMSObject
  40       */
  41      protected $state;
  42  
  43      /**
  44       * Method to display the view.
  45       *
  46       * @param   string  $tpl  A template file to load. [optional]
  47       *
  48       * @return  void
  49       *
  50       * @since   3.2
  51       */
  52      public function display($tpl = null)
  53      {
  54          $this->state = $this->get('State');
  55          $this->item  = $this->get('Item');
  56  
  57          if (false === $this->item) {
  58              Factory::getLanguage()->load('com_content', JPATH_SITE, null, true);
  59  
  60              throw new \Exception(Text::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'), 404);
  61          }
  62  
  63          // Check for errors.
  64          if (count($errors = $this->get('Errors'))) {
  65              throw new GenericDataException(implode("\n", $errors), 500);
  66          }
  67  
  68          parent::display($tpl);
  69      }
  70  }


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