[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_fields/src/Controller/ -> GroupsController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.API
   5   * @subpackage  com_fields
   6   *
   7   * @copyright   (C) 2019 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\Api\Controller;
  12  
  13  use Joomla\CMS\MVC\Controller\ApiController;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('_JEXEC') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * The groups controller
  21   *
  22   * @since  4.0.0
  23   */
  24  class GroupsController extends ApiController
  25  {
  26      /**
  27       * The content type of the item.
  28       *
  29       * @var    string
  30       * @since  4.0.0
  31       */
  32      protected $contentType = 'groups';
  33  
  34      /**
  35       * The default view for the display method.
  36       *
  37       * @var    string
  38       * @since  3.0
  39       */
  40      protected $default_view = 'groups';
  41  
  42      /**
  43       * Basic display of an item view
  44       *
  45       * @param   integer  $id  The primary key to display. Leave empty if you want to retrieve data from the request
  46       *
  47       * @return  static  A \JControllerLegacy object to support chaining.
  48       *
  49       * @since   4.0.0
  50       */
  51      public function displayItem($id = null)
  52      {
  53          $this->modelState->set('filter.context', $this->getContextFromInput());
  54  
  55          return parent::displayItem($id);
  56      }
  57  
  58      /**
  59       * Basic display of a list view
  60       *
  61       * @return  static  A \JControllerLegacy object to support chaining.
  62       *
  63       * @since   4.0.0
  64       */
  65      public function displayList()
  66      {
  67          $this->modelState->set('filter.context', $this->getContextFromInput());
  68  
  69          return parent::displayList();
  70      }
  71  
  72      /**
  73       * Get extension from input
  74       *
  75       * @return string
  76       *
  77       * @since 4.0.0
  78       */
  79      private function getContextFromInput()
  80      {
  81          return $this->input->exists('context') ?
  82              $this->input->get('context') : $this->input->post->get('context');
  83      }
  84  }


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