[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_finder
   6   *
   7   * @copyright   (C) 2011 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\Finder\Administrator\Controller;
  12  
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\MVC\Controller\BaseController;
  16  use Joomla\CMS\Plugin\PluginHelper;
  17  use Joomla\CMS\Router\Route;
  18  use Joomla\Component\Finder\Administrator\Helper\FinderHelper;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('_JEXEC') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * Base controller class for Finder.
  26   *
  27   * @since  2.5
  28   */
  29  class DisplayController extends BaseController
  30  {
  31      /**
  32       * The default view.
  33       *
  34       * @var    string
  35       * @since  2.5
  36       */
  37      protected $default_view = 'index';
  38  
  39      /**
  40       * Method to display a view.
  41       *
  42       * @param   boolean  $cachable   If true, the view output will be cached
  43       * @param   array    $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
  44       *
  45       * @return  static|boolean   A Controller object to support chaining or false on failure.
  46       *
  47       * @since   2.5
  48       */
  49      public function display($cachable = false, $urlparams = array())
  50      {
  51          $view   = $this->input->get('view', 'index', 'word');
  52          $layout = $this->input->get('layout', 'index', 'word');
  53          $filterId = $this->input->get('filter_id', null, 'int');
  54  
  55          if ($view === 'index') {
  56              $pluginEnabled    = PluginHelper::isEnabled('content', 'finder');
  57  
  58              if (!$pluginEnabled) {
  59                  $finderPluginId   = FinderHelper::getFinderPluginId();
  60                  $link = HTMLHelper::_(
  61                      'link',
  62                      '#plugin' . $finderPluginId . 'Modal',
  63                      Text::_('COM_FINDER_CONTENT_PLUGIN'),
  64                      'class="alert-link" data-bs-toggle="modal" id="title-' . $finderPluginId . '"'
  65                  );
  66                  $this->app->enqueueMessage(Text::sprintf('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED_LINK', $link), 'warning');
  67              }
  68          }
  69  
  70          // Check for edit form.
  71          if ($view === 'filter' && $layout === 'edit' && !$this->checkEditId('com_finder.edit.filter', $filterId)) {
  72              // Somehow the person just went to the form - we don't allow that.
  73              if (!\count($this->app->getMessageQueue())) {
  74                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $f_id), 'error');
  75              }
  76  
  77              $this->setRedirect(Route::_('index.php?option=com_finder&view=filters', false));
  78  
  79              return false;
  80          }
  81  
  82          return parent::display();
  83      }
  84  }


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