[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_messages/src/View/Config/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_messages
   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\Messages\Administrator\View\Config;
  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\Toolbar\ToolbarHelper;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * View to edit messages user configuration.
  25   *
  26   * @since  1.6
  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 active item
  39       *
  40       * @var  object
  41       */
  42      protected $item;
  43  
  44      /**
  45       * The model state
  46       *
  47       * @var  \Joomla\CMS\Object\CMSObject
  48       */
  49      protected $state;
  50  
  51      /**
  52       * Execute and display a template script.
  53       *
  54       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  55       *
  56       * @return  void
  57       *
  58       * @since   1.6
  59       */
  60      public function display($tpl = null)
  61      {
  62          $this->form  = $this->get('Form');
  63          $this->item  = $this->get('Item');
  64          $this->state = $this->get('State');
  65  
  66          // Check for errors.
  67          if (count($errors = $this->get('Errors'))) {
  68              throw new GenericDataException(implode("\n", $errors), 500);
  69          }
  70  
  71          // Bind the record to the form.
  72          $this->form->bind($this->item);
  73  
  74          $this->addToolbar();
  75  
  76          parent::display($tpl);
  77      }
  78  
  79      /**
  80       * Add the page title and toolbar.
  81       *
  82       * @return  void
  83       *
  84       * @since   4.0.0
  85       */
  86      protected function addToolbar()
  87      {
  88          Factory::getApplication()->input->set('hidemainmenu', true);
  89  
  90          ToolbarHelper::title(Text::_('COM_MESSAGES_TOOLBAR_MY_SETTINGS'), 'envelope');
  91  
  92          ToolbarHelper::apply('config.save', 'JSAVE');
  93  
  94          ToolbarHelper::cancel('config.cancel', 'JCANCEL');
  95      }
  96  }


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