[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.API 5 * @subpackage com_modules 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\Modules\Api\View\Modules; 12 13 use Joomla\CMS\MVC\View\JsonApiView as BaseApiView; 14 use Joomla\CMS\Router\Exception\RouteNotFoundException; 15 use Joomla\Component\Modules\Administrator\Model\SelectModel; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * The modules view 23 * 24 * @since 4.0.0 25 */ 26 class JsonapiView extends BaseApiView 27 { 28 /** 29 * The fields to render item in the documents 30 * 31 * @var array 32 * @since 4.0.0 33 */ 34 protected $fieldsToRenderItem = [ 35 'id', 36 'typeAlias', 37 'asset_id', 38 'title', 39 'note', 40 'content', 41 'ordering', 42 'position', 43 'checked_out', 44 'checked_out_time', 45 'publish_up', 46 'publish_down', 47 'published', 48 'module', 49 'access', 50 'showtitle', 51 'params', 52 'client_id', 53 'language', 54 'assigned', 55 'assignment', 56 'xml', 57 ]; 58 59 /** 60 * The fields to render items in the documents 61 * 62 * @var array 63 * @since 4.0.0 64 */ 65 protected $fieldsToRenderList = [ 66 'id', 67 'title', 68 'note', 69 'position', 70 'module', 71 'language', 72 'checked_out', 73 'checked_out_time', 74 'published', 75 'enabled', 76 'access', 77 'ordering', 78 'publish_up', 79 'publish_down', 80 'language_title', 81 'language_image', 82 'editor', 83 'access_level', 84 'pages', 85 'name', 86 ]; 87 88 /** 89 * Execute and display a template script. 90 * 91 * @param object $item Item 92 * 93 * @return string 94 * 95 * @since 4.0.0 96 */ 97 public function displayItem($item = null) 98 { 99 /** @var \Joomla\CMS\MVC\Model\AdminModel $model */ 100 $model = $this->getModel(); 101 102 if ($item === null) { 103 $item = $this->prepareItem($model->getItem()); 104 } 105 106 if ($item->id === null) { 107 throw new RouteNotFoundException('Item does not exist'); 108 } 109 110 if ((int) $model->getState('client_id') !== $item->client_id) { 111 throw new RouteNotFoundException('Item does not exist'); 112 } 113 114 return parent::displayItem($item); 115 } 116 117 /** 118 * Execute and display a list modules types. 119 * 120 * @return string 121 * 122 * @since 4.0.0 123 */ 124 public function displayListTypes() 125 { 126 /** @var SelectModel $model */ 127 $model = $this->getModel(); 128 $items = []; 129 130 foreach ($model->getItems() as $item) { 131 $item->id = $item->extension_id; 132 unset($item->extension_id); 133 134 $items[] = $item; 135 } 136 137 $this->fieldsToRenderList = ['id', 'name', 'module', 'xml', 'desc']; 138 139 return parent::displayList($items); 140 } 141 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |