[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage Fields.List 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 10 * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace 11 */ 12 13 // phpcs:disable PSR1.Files.SideEffects 14 \defined('_JEXEC') or die; 15 // phpcs:enable PSR1.Files.SideEffects 16 17 /** 18 * Fields list Plugin 19 * 20 * @since 3.7.0 21 */ 22 class PlgFieldsList extends \Joomla\Component\Fields\Administrator\Plugin\FieldsListPlugin 23 { 24 /** 25 * Before prepares the field value. 26 * 27 * @param string $context The context. 28 * @param \stdclass $item The item. 29 * @param \stdclass $field The field. 30 * 31 * @return void 32 * 33 * @since 3.7.0 34 */ 35 public function onCustomFieldsBeforePrepareField($context, $item, $field) 36 { 37 if (!$this->app->isClient('api')) { 38 return; 39 } 40 41 if (!$this->isTypeSupported($field->type)) { 42 return; 43 } 44 45 $options = $this->getOptionsFromField($field); 46 47 $field->apivalue = [$field->value => $options[$field->value]]; 48 } 49 50 /** 51 * Prepares the field 52 * 53 * @param string $context The context. 54 * @param stdclass $item The item. 55 * @param stdclass $field The field. 56 * 57 * @return object 58 * 59 * @since 3.9.2 60 */ 61 public function onCustomFieldsPrepareField($context, $item, $field) 62 { 63 // Check if the field should be processed 64 if (!$this->isTypeSupported($field->type)) { 65 return; 66 } 67 68 // The field's rawvalue should be an array 69 if (!is_array($field->rawvalue)) { 70 $field->rawvalue = (array) $field->rawvalue; 71 } 72 73 return parent::onCustomFieldsPrepareField($context, $item, $field); 74 } 75 }
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 |