[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_languages/src/View/Languages/ -> JsonapiView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.API
   5   * @subpackage  com_languages
   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\Languages\Api\View\Languages;
  12  
  13  use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('_JEXEC') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * The languages view
  21   *
  22   * @since  4.0.0
  23   */
  24  class JsonapiView extends BaseApiView
  25  {
  26      /**
  27       * The fields to render item in the documents
  28       *
  29       * @var  array
  30       * @since  4.0.0
  31       */
  32      protected $fieldsToRenderItem = [
  33          'id',
  34          'asset_id',
  35          'lang_code',
  36          'title',
  37          'title_native',
  38          'sef',
  39          'image',
  40          'description',
  41          'metakey',
  42          'metadesc',
  43          'sitename',
  44          'published',
  45          'access',
  46          'ordering',
  47          'access_level',
  48          'home',
  49      ];
  50  
  51      /**
  52       * The fields to render items in the documents
  53       *
  54       * @var  array
  55       * @since  4.0.0
  56       */
  57      protected $fieldsToRenderList = [
  58          'id',
  59          'asset_id',
  60          'lang_code',
  61          'title',
  62          'title_native',
  63          'sef',
  64          'image',
  65          'description',
  66          'metakey',
  67          'metadesc',
  68          'sitename',
  69          'published',
  70          'access',
  71          'ordering',
  72          'access_level',
  73          'home',
  74      ];
  75  
  76      /**
  77       * Prepare item before render.
  78       *
  79       * @param   object  $item  The model item
  80       *
  81       * @return  object
  82       *
  83       * @since   4.0.0
  84       */
  85      protected function prepareItem($item)
  86      {
  87          $item->id = $item->lang_id;
  88          unset($item->lang->id);
  89  
  90          return parent::prepareItem($item);
  91      }
  92  }


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