[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/api/components/com_media/src/View/Media/ -> JsonapiView.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.API
   4   * @subpackage  com_media
   5   *
   6   * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\Component\Media\Api\View\Media;
  11  
  12  \defined('_JEXEC') or die;
  13  
  14  use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
  15  use Joomla\Component\Media\Administrator\Provider\ProviderManagerHelperTrait;
  16  
  17  /**
  18   * Media web service view
  19   *
  20   * @since  4.1.0
  21   */
  22  class JsonapiView extends BaseApiView
  23  {
  24      use ProviderManagerHelperTrait;
  25  
  26      /**
  27       * The fields to render item in the documents
  28       *
  29       * @var    array
  30       * @since  4.1.0
  31       */
  32      protected $fieldsToRenderItem = [
  33          'type',
  34          'name',
  35          'path',
  36          'extension',
  37          'size',
  38          'mime_type',
  39          'width',
  40          'height',
  41          'create_date',
  42          'create_date_formatted',
  43          'modified_date',
  44          'modified_date_formatted',
  45          'thumb_path',
  46          'adapter',
  47          'content',
  48          'url',
  49          'tempUrl',
  50      ];
  51  
  52      /**
  53       * The fields to render items in the documents
  54       *
  55       * @var    array
  56       * @since  4.1.0
  57       */
  58      protected $fieldsToRenderList = [
  59          'type',
  60          'name',
  61          'path',
  62          'extension',
  63          'size',
  64          'mime_type',
  65          'width',
  66          'height',
  67          'create_date',
  68          'create_date_formatted',
  69          'modified_date',
  70          'modified_date_formatted',
  71          'thumb_path',
  72          'adapter',
  73          'content',
  74          'url',
  75          'tempUrl',
  76      ];
  77  
  78      /**
  79       * Prepare item before render.
  80       *
  81       * @param   object  $item  The model item
  82       *
  83       * @return  object
  84       *
  85       * @since   4.1.0
  86       */
  87  	protected function prepareItem($item)
  88      {
  89          // Media resources have no id.
  90          $item->id = '0';
  91  
  92          return $item;
  93      }
  94  }


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