[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/form/field/ -> email.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\String\PunycodeHelper;
  14  
  15  extract($displayData);
  16  
  17  /**
  18   * Layout variables
  19   * -----------------
  20   * @var   string   $autocomplete    Autocomplete attribute for the field.
  21   * @var   boolean  $autofocus       Is autofocus enabled?
  22   * @var   string   $class           Classes for the input.
  23   * @var   string   $description     Description of the field.
  24   * @var   boolean  $disabled        Is this field disabled?
  25   * @var   string   $group           Group the field belongs to. <fields> section in form XML.
  26   * @var   boolean  $hidden          Is this field hidden in the form?
  27   * @var   string   $hint            Placeholder for the field.
  28   * @var   string   $id              DOM id of the field.
  29   * @var   string   $label           Label of the field.
  30   * @var   string   $labelclass      Classes to apply to the label.
  31   * @var   boolean  $multiple        Does this field support multiple values?
  32   * @var   string   $name            Name of the input field.
  33   * @var   string   $onchange        Onchange attribute for the field.
  34   * @var   string   $onclick         Onclick attribute for the field.
  35   * @var   string   $pattern         Pattern (Reg Ex) of value of the form field.
  36   * @var   boolean  $readonly        Is this field read only?
  37   * @var   boolean  $repeat          Allows extensions to duplicate elements.
  38   * @var   boolean  $required        Is this field required?
  39   * @var   integer  $size            Size attribute of the input.
  40   * @var   boolean  $spellcheck      Spellcheck state for the form field.
  41   * @var   string   $validate        Validation rules to apply.
  42   * @var   string   $value           Value attribute of the field.
  43   * @var   array    $checkedOptions  Options that will be set as checked.
  44   * @var   boolean  $hasValue        Has this field a value assigned?
  45   * @var   array    $options         Options available for this field.
  46   * @var   array    $inputType       Options available for this field.
  47   * @var   string   $accept          File types that are accepted.
  48   * @var   string   $dataAttribute   Miscellaneous data attributes preprocessed for HTML output
  49   * @var   array    $dataAttributes  Miscellaneous data attribute for eg, data-*.
  50   */
  51  
  52  $attributes = [
  53      'type="email"',
  54      'inputmode="email"',
  55      'name="' . $name . '"',
  56      'class="form-control validate-email' . (!empty($class) ? ' ' . $class : '') . '"',
  57      'id="' . $id . '"',
  58      'value="' . htmlspecialchars(PunycodeHelper::emailToUTF8($value), ENT_COMPAT, 'UTF-8') . '"',
  59      $spellcheck ? '' : 'spellcheck="false"',
  60      !empty($size) ? 'size="' . $size . '"' : '',
  61      !empty($description) ? 'aria-describedby="' . ($id ?: $name) . '-desc"' : '',
  62      $disabled ? 'disabled' : '',
  63      $readonly ? 'readonly' : '',
  64      $onchange ? 'onchange="' . $onchange . '"' : '',
  65      !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
  66      $multiple ? 'multiple' : '',
  67      !empty($maxLength) ? 'maxlength="' . $maxLength . '"' : '',
  68      strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
  69      $required ? 'required' : '',
  70      $autofocus ? 'autofocus' : '',
  71      $dataAttribute,
  72  ];
  73  
  74  echo '<input ' . implode(' ', array_values(array_filter($attributes))) . '>';


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