[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_languages
   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\Languages\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   * Languages Controller.
  23   *
  24   * @since  1.5
  25   */
  26  class DisplayController extends BaseController
  27  {
  28      /**
  29       * @var     string  The default view.
  30       * @since   1.6
  31       */
  32      protected $default_view = 'installed';
  33  
  34      /**
  35       * Method to display a view.
  36       *
  37       * @param   boolean  $cachable   If true, the view output will be cached.
  38       * @param   array    $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', $this->default_view);
  47          $layout = $this->input->get('layout', 'default');
  48          $id     = $this->input->getInt('id');
  49  
  50          // Check for edit form.
  51          if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) {
  52              // Somehow the person just went to the form - we don't allow that.
  53              if (!\count($this->app->getMessageQueue())) {
  54                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
  55              }
  56  
  57              $this->setRedirect(Route::_('index.php?option=com_languages&view=languages', false));
  58  
  59              return false;
  60          }
  61  
  62          return parent::display();
  63      }
  64  }


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