[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_content/src/Field/ -> AssocField.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_content
   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  
  11  namespace Joomla\Component\Content\Administrator\Field;
  12  
  13  use Joomla\CMS\Form\Field\ListField;
  14  use Joomla\CMS\Language\Associations;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Assoc Field class.
  22   * Supports a generic list of options.
  23   * Displays only when Associations are enabled.
  24   *
  25   * @since  4.0.0
  26   */
  27  class AssocField extends ListField
  28  {
  29      /**
  30       * The form field type.
  31       *
  32       * @var    string
  33       * @since  4.0.0
  34       */
  35      protected $type = 'Assoc';
  36  
  37      /**
  38       * Method to attach a Form object to the field.
  39       *
  40       * @param   \SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  41       * @param   mixed              $value    The form field value to validate.
  42       * @param   string             $group    The field name group control value. This acts as an array container for the field.
  43       *                                       For example if the field has name="foo" and the group value is set to "bar" then the
  44       *                                       full field name would end up being "bar[foo]".
  45       *
  46       * @return  boolean  True on success.
  47       *
  48       * @see     AssocField::setup()
  49       * @since   4.0.0
  50       */
  51      public function setup(\SimpleXMLElement $element, $value, $group = null)
  52      {
  53          if (!Associations::isEnabled()) {
  54              return false;
  55          }
  56  
  57          return parent::setup($element, $value, $group);
  58      }
  59  }


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