Source for file tel.php

Documentation is available at tel.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Form
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 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.  
  13. /**
  14.  * Form Field class for the Joomla Platform.
  15.  * Supports a text field telephone numbers.
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Form
  19.  * @link        http://www.w3.org/TR/html-markup/input.tel.html
  20.  * @see         JFormRuleTel for telephone number validation
  21.  * @see         JHtmlTel for rendering of telephone numbers
  22.  * @since       11.1
  23.  */
  24. class JFormFieldTel extends JFormFieldText
  25. {
  26.     /**
  27.      * The form field type.
  28.      *
  29.      * @var    string 
  30.      * @since  11.1
  31.      */
  32.     protected $type = 'Tel';
  33.  
  34.     /**
  35.      * Method to get the field input markup.
  36.      *
  37.      * @return  string  The field input markup.
  38.      *
  39.      * @since   3.2
  40.      */
  41.     protected function getInput()
  42.     {
  43.         // Translate placeholder text
  44.         $hint $this->translateHint ? JText::_($this->hint$this->hint;
  45.  
  46.         // Initialize some field attributes.
  47.         $size         !empty($this->size' size="' $this->size . '"' '';
  48.         $maxLength    !empty($this->maxLength' maxlength="' $this->maxLength . '"' '';
  49.         $class        !empty($this->class' class="' $this->class . '"' '';
  50.         $readonly     $this->readonly ? ' readonly' '';
  51.         $disabled     $this->disabled ? ' disabled' '';
  52.         $required     $this->required ? ' required aria-required="true"' '';
  53.         $hint         $hint ' placeholder="' $hint '"' '';
  54.         $autocomplete !$this->autocomplete ? ' autocomplete="off"' ' autocomplete="' $this->autocomplete . '"';
  55.         $autocomplete $autocomplete == ' autocomplete="on"' '' $autocomplete;
  56.         $autofocus    $this->autofocus ? ' autofocus' '';
  57.         $spellcheck   $this->spellcheck ? '' ' spellcheck="false"';
  58.  
  59.         // Initialize JavaScript field attributes.
  60.         $onchange $this->onchange ? ' onchange="' $this->onchange . '"' '';
  61.  
  62.         // Including fallback code for HTML5 non supported browsers.
  63.         JHtml::_('jquery.framework');
  64.         JHtml::_('script''system/html5fallback.js'falsetrue);
  65.  
  66.         return '<input type="tel" name="' $this->name . '"' $class ' id="' $this->id . '" value="'
  67.             . htmlspecialchars($this->valueENT_COMPAT'UTF-8''"' $size $disabled $readonly
  68.             . $hint $autocomplete $autofocus $spellcheck $onchange $maxLength $required ' />';
  69.     }
  70. }

Documentation generated on Tue, 19 Nov 2013 15:15:23 +0100 by phpDocumentor 1.4.3