[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_installer/src/Controller/ -> ManageController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.API
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2020 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\Installer\Api\Controller;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\MVC\Controller\ApiController;
  15  use Tobscure\JsonApi\Exception\InvalidParameterException;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * The manage controller
  23   *
  24   * @since  4.0.0
  25   */
  26  class ManageController extends ApiController
  27  {
  28      /**
  29       * The content type of the item.
  30       *
  31       * @var    string
  32       * @since  4.0.0
  33       */
  34      protected $contentType = 'manage';
  35  
  36      /**
  37       * The default view for the display method.
  38       *
  39       * @var    string
  40       * @since  4.0.0
  41       */
  42      protected $default_view = 'manage';
  43  
  44      /**
  45       * Extension list view amended to add filtering of data
  46       *
  47       * @return  static  A BaseController object to support chaining.
  48       *
  49       * @since   4.0.0
  50       */
  51      public function displayList()
  52      {
  53          $requestBool = $this->input->get('core', $this->input->get->get('core'));
  54  
  55          if (!\is_null($requestBool) && $requestBool !== 'true' && $requestBool !== 'false') {
  56              // Send the error response
  57              $error = Text::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'core');
  58  
  59              throw new InvalidParameterException($error, 400, null, 'core');
  60          }
  61  
  62          if (!\is_null($requestBool)) {
  63              $this->modelState->set('filter.core', ($requestBool === 'true') ? '1' : '0');
  64          }
  65  
  66          $this->modelState->set('filter.status', $this->input->get('status', $this->input->get->get('status', null, 'INT'), 'INT'));
  67          $this->modelState->set('filter.type', $this->input->get('type', $this->input->get->get('type', null, 'STRING'), 'STRING'));
  68  
  69          return parent::displayList();
  70      }
  71  }


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