[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2017 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  extract($displayData);
  14  
  15  use Joomla\CMS\HTML\HTMLHelper;
  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    $options         Options available for this field.
  44   * @var   string   $dataAttribute   Miscellaneous data attributes preprocessed for HTML output
  45   * @var   array    $dataAttributes  Miscellaneous data attribute for eg, data-*.
  46   */
  47  
  48  HTMLHelper::_('behavior.combobox');
  49  
  50  $attr = '';
  51  
  52  // Initialize some field attributes.
  53  $attr .= !empty($class) ? ' class="awesomplete form-control ' . $class . '"' : ' class="awesomplete form-control"';
  54  $attr .= !empty($size) ? ' size="' . $size . '"' : '';
  55  $attr .= !empty($readonly) ? ' readonly' : '';
  56  $attr .= !empty($disabled) ? ' disabled' : '';
  57  $attr .= !empty($required) ? ' required' : '';
  58  $attr .= !empty($description) ? ' aria-describedby="' . ($id ?: $name) . '-desc"' : '';
  59  
  60  // Initialize JavaScript field attributes.
  61  $attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
  62  
  63  $val  = [];
  64  
  65  foreach ($options as $option) {
  66      $val[] = $option->text;
  67  }
  68  ?>
  69  <input
  70      type="text"
  71      name="<?php echo $name; ?>"
  72      id="<?php echo $id; ?>"
  73      value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
  74      <?php echo $attr; ?>
  75      data-list="<?php echo implode(', ', $val); ?>"
  76      <?php echo $dataAttribute; ?>
  77  />


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