[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_templates/src/Controller/ -> DisplayController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_templates
   6   *
   7   * @copyright   (C) 2006 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\Templates\Administrator\Controller;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\MVC\Controller\BaseController;
  15  use Joomla\CMS\Router\Route;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Templates manager master display controller.
  23   *
  24   * @since  1.6
  25   */
  26  class DisplayController extends BaseController
  27  {
  28      /**
  29       * @var     string  The default view.
  30       * @since   1.6
  31       */
  32      protected $default_view = 'styles';
  33  
  34      /**
  35       * Method to display a view.
  36       *
  37       * @param   boolean  $cachable   If true, the view output will be cached
  38       * @param   boolean  $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
  39       *
  40       * @return  static|boolean   This object to support chaining or false on failure.
  41       *
  42       * @since   1.5
  43       */
  44      public function display($cachable = false, $urlparams = false)
  45      {
  46          $view   = $this->input->get('view', 'styles');
  47          $layout = $this->input->get('layout', 'default');
  48          $id     = $this->input->getInt('id');
  49  
  50          // For JSON requests
  51          if ($this->app->getDocument()->getType() == 'json') {
  52              return parent::display();
  53          }
  54  
  55          // Check for edit form.
  56          if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) {
  57              // Somehow the person just went to the form - we don't allow that.
  58              if (!\count($this->app->getMessageQueue())) {
  59                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
  60              }
  61  
  62              $this->setRedirect(Route::_('index.php?option=com_templates&view=styles', false));
  63  
  64              return false;
  65          }
  66  
  67          return parent::display();
  68      }
  69  }


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