CoreFiles by mySites.guru
JsonapiView.php94 lines, 1,548 bytes, from Joomla_4.1.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.1.0-beta2
md5
a8e98e81efe0d306539726529e5ac75d
sha1
7513f601f661bf2489c28d37646a72b237493e04
sha256
04098aaa8c1090f97953bc435b9cc6c3f38263477308b4a3700fb65dd17b633b
<?php
/**
 * @package     Joomla.API
 * @subpackage  com_media
 *
 * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Media\Api\View\Media;

\defined('_JEXEC') or die;

use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
use Joomla\Component\Media\Api\Helper\AdapterTrait;

/**
 * Media web service view
 *
 * @since  4.1.0
 */
class JsonapiView extends BaseApiView
{
	use AdapterTrait;

	/**
	 * The fields to render item in the documents
	 *
	 * @var    array
	 * @since  4.1.0
	 */
	protected $fieldsToRenderItem = [
		'type',
		'name',
		'path',
		'extension',
		'size',
		'mime_type',
		'width',
		'height',
		'create_date',
		'create_date_formatted',
		'modified_date',
		'modified_date_formatted',
		'thumb_path',
		'adapter',
		'content',
		'url',
		'tempUrl',
	];

	/**
	 * The fields to render items in the documents
	 *
	 * @var    array
	 * @since  4.1.0
	 */
	protected $fieldsToRenderList = [
		'type',
		'name',
		'path',
		'extension',
		'size',
		'mime_type',
		'width',
		'height',
		'create_date',
		'create_date_formatted',
		'modified_date',
		'modified_date_formatted',
		'thumb_path',
		'adapter',
		'content',
		'url',
		'tempUrl',
	];

	/**
	 * Prepare item before render.
	 *
	 * @param   object  $item  The model item
	 *
	 * @return  object
	 *
	 * @since   4.1.0
	 */
	protected function prepareItem($item)
	{
		// Media resources have no id.
		$item->id = '0';

		return $item;
	}
}

The same content is in 3 releases, Joomla 4.1.0-beta1 to 4.1.0-beta3. See them all, or every version of this file.