PageRenderTime 51ms CodeModel.GetById 43ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/libraries/joomla/form/fields/range.php

https://gitlab.com/vitaliylukin91/lavka
PHP | 64 lines | 25 code | 9 blank | 30 comment | 0 complexity | 18ee8339a7dd9aa224b3285b755823d6 MD5 | raw file
 1<?php
 2/**
 3 * @package     Joomla.Platform
 4 * @subpackage  Form
 5 *
 6 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 7 * @license     GNU General Public License version 2 or later; see LICENSE
 8 */
 9
10defined('JPATH_PLATFORM') or die;
11
12JFormHelper::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 */
21class 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	 * Method to get the field input markup.
33	 *
34	 * @return  string  The field input markup.
35	 *
36	 * @since   3.2
37	 */
38	protected function getInput()
39	{
40		// Initialize some field attributes.
41		$max      = !empty($this->max) ? ' max="' . $this->max . '"' : '';
42		$min      = !empty($this->min) ? ' min="' . $this->min . '"' : '';
43		$step     = !empty($this->step) ? ' step="' . $this->step . '"' : '';
44		$class    = !empty($this->class) ? ' class="' . $this->class . '"' : '';
45		$readonly = $this->readonly ? ' readonly' : '';
46		$disabled = $this->disabled ? ' disabled' : '';
47
48		$autofocus = $this->autofocus ? ' autofocus' : '';
49
50		$value = (float) $this->value;
51		$value = empty($value) ? $this->min : $value;
52
53		// Initialize JavaScript field attributes.
54		$onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
55
56		// Including fallback code for HTML5 non supported browsers.
57		JHtml::_('jquery.framework');
58		JHtml::_('script', 'system/html5fallback.js', false, true);
59
60		return '<input type="range" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
61			. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $disabled . $readonly
62			. $onchange . $max . $step . $min . $autofocus . ' />';
63	}
64}