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