* @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access to this JCB template file (EVER) defined('_JCB_TEMPLATE') or die; ?> ###BOM### namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\View\###Views###; ###API_VIEWS_JSON_HEADER### use ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Api\Serializer\###View###Serializer; // No direct access to this file \defined('_JEXEC') or die; /** * ###Component### Json View class for the ###Views### * * @since 4.0.0 */ class JsonapiView extends BaseApiView { /** * The fields to render items in the documents * * @var array * @since 4.0.0 */ protected $fieldsToRenderList = [###API_VIEWS_JSON_FIELDS### ]; /** * The relationships the items have * * @var array * @since 4.0.0 */ protected $relationship = [###API_VIEWS_JSON_RELATIONSHIP### ]; /** * Constructor. * * @param array $config A named configuration array for object construction. * contentType: the name (optional) of the content type to use for the serialization * * @since 4.0.0 */ public function __construct($config = []) { if (\array_key_exists('contentType', $config)) { $this->serializer = new ###View###Serializer($config['contentType']); } parent::__construct($config); } /** * Execute and display a template script. * * @param ?array $items Array of items * * @return string * * @since 4.0.0 */ public function displayList(?array $items = null) {###API_VIEWS_JSON_PERMISSIONS### return parent::displayList($items); } /** * Prepare item before render. * * @param object $item The model item * * @return object * * @since 4.0.0 */ protected function prepareItem($item) {###API_VIEWS_JSON_PREPAREITEM### return parent::prepareItem($item); } }