[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/fields/radio/ -> radio.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Fields.Radio
   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 Radio Plugin
  19   *
  20   * @since  3.7.0
  21   */
  22  class PlgFieldsRadio 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  }


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