[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Form/Field/ -> RangeField.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Form\Field;
  11  
  12  // phpcs:disable PSR1.Files.SideEffects
  13  \defined('JPATH_PLATFORM') or die;
  14  // phpcs:enable PSR1.Files.SideEffects
  15  
  16  /**
  17   * Form Field class for the Joomla Platform.
  18   * Provides a horizontal scroll bar to specify a value in a range.
  19   *
  20   * @link   https://html.spec.whatwg.org/multipage/input.html#range-state-(type=range)
  21   * @since  3.2
  22   */
  23  class RangeField extends NumberField
  24  {
  25      /**
  26       * The form field type.
  27       *
  28       * @var    string
  29       * @since  3.2
  30       */
  31      protected $type = 'Range';
  32  
  33      /**
  34       * Name of the layout being used to render the field
  35       *
  36       * @var    string
  37       * @since  3.7
  38       */
  39      protected $layout = 'joomla.form.field.range';
  40  
  41      /**
  42       * Method to get the field input markup.
  43       *
  44       * @return  string  The field input markup.
  45       *
  46       * @since   3.2
  47       */
  48      protected function getInput()
  49      {
  50          return $this->getRenderer($this->layout)->render($this->getLayoutData());
  51      }
  52  
  53      /**
  54       * Method to get the data to be passed to the layout for rendering.
  55       *
  56       * @return  array
  57       *
  58       * @since 3.7
  59       */
  60      protected function getLayoutData()
  61      {
  62          $data = parent::getLayoutData();
  63  
  64          // Initialize some field attributes.
  65          $extraData = array(
  66              'max' => $this->max,
  67              'min' => $this->min,
  68              'step' => $this->step,
  69          );
  70  
  71          return array_merge($data, $extraData);
  72      }
  73  }


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