[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_templates/src/View/Styles/ -> JsonapiView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.API
   5   * @subpackage  com_templates
   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\Templates\Api\View\Styles;
  12  
  13  use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
  14  use Joomla\CMS\Router\Exception\RouteNotFoundException;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * The styles view
  22   *
  23   * @since  4.0.0
  24   */
  25  class JsonapiView extends BaseApiView
  26  {
  27      /**
  28       * The fields to render item in the documents
  29       *
  30       * @var  array
  31       * @since  4.0.0
  32       */
  33      protected $fieldsToRenderItem = [
  34          'id',
  35          'template',
  36          'client_id',
  37          'home',
  38          'title',
  39          'params',
  40          'xml',
  41      ];
  42  
  43      /**
  44       * The fields to render items in the documents
  45       *
  46       * @var  array
  47       * @since  4.0.0
  48       */
  49      protected $fieldsToRenderList = [
  50          'id',
  51          'template',
  52          'title',
  53          'home',
  54          'client_id',
  55          'language_title',
  56          'image',
  57          'language_sef',
  58          'assigned',
  59          'e_id',
  60      ];
  61  
  62      /**
  63       * Prepare item before render.
  64       *
  65       * @param   object  $item  The model item
  66       *
  67       * @return  object
  68       *
  69       * @since   4.0.0
  70       */
  71      protected function prepareItem($item)
  72      {
  73          if ($item->client_id != $this->getModel()->getState('client_id')) {
  74              throw new RouteNotFoundException('Item does not exist');
  75          }
  76  
  77          return parent::prepareItem($item);
  78      }
  79  }


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