[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_messages/src/View/Messages/ -> JsonapiView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.API
   5   * @subpackage  com_messages
   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\Messages\Api\View\Messages;
  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 messages 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          'user_id_from',
  35          'user_id_to',
  36          'date_time',
  37          'priority',
  38          'subject',
  39          'message',
  40          'state',
  41          'user_from',
  42      ];
  43  
  44      /**
  45       * The fields to render items in the documents
  46       *
  47       * @var  array
  48       * @since  4.0.0
  49       */
  50      protected $fieldsToRenderList = [
  51          'id',
  52          'user_id_from',
  53          'user_id_to',
  54          'date_time',
  55          'priority',
  56          'subject',
  57          'message',
  58          'state',
  59          'user_from',
  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          $item->id = $item->message_id;
  74          unset($item->message_id);
  75  
  76          return parent::prepareItem($item);
  77      }
  78  }


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