[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_fields
   6   *
   7   * @copyright   (C) 2016 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\Fields\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   * Fields Controller
  23   *
  24   * @since  3.7.0
  25   */
  26  class DisplayController extends BaseController
  27  {
  28      /**
  29       * The default view.
  30       *
  31       * @var    string
  32       *
  33       * @since   3.7.0
  34       */
  35      protected $default_view = 'fields';
  36  
  37      /**
  38       * Typical view method for MVC based architecture
  39       *
  40       * This function is provide as a default implementation, in most cases
  41       * you will need to override it in your own controllers.
  42       *
  43       * @param   boolean     $cachable   If true, the view output will be cached
  44       * @param   array|bool  $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}
  45       *
  46       * @return  BaseController|boolean  A Controller object to support chaining.
  47       *
  48       * @since   3.7.0
  49       */
  50      public function display($cachable = false, $urlparams = false)
  51      {
  52          // Set the default view name and format from the Request.
  53          $vName   = $this->input->get('view', 'fields');
  54          $id      = $this->input->getInt('id');
  55  
  56          // Check for edit form.
  57          if ($vName == 'field' && !$this->checkEditId('com_fields.edit.field', $id)) {
  58              // Somehow the person just went to the form - we don't allow that.
  59              if (!\count($this->app->getMessageQueue())) {
  60                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
  61              }
  62  
  63              $this->setRedirect(Route::_('index.php?option=com_fields&view=fields&context=' . $this->input->get('context'), false));
  64  
  65              return false;
  66          }
  67  
  68          return parent::display($cachable, $urlparams);
  69      }
  70  }


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