[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage Layout 6 * 7 * @copyright (C) 2018 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\Factory; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\Uri\Uri; 17 18 extract($displayData); 19 20 /** 21 * Layout variables 22 * ----------------- 23 * @var string $autocomplete Autocomplete attribute for the field. 24 * @var boolean $autofocus Is autofocus enabled? 25 * @var string $class Classes for the input. 26 * @var string $description Description of the field. 27 * @var boolean $disabled Is this field disabled? 28 * @var string $group Group the field belongs to. <fields> section in form XML. 29 * @var boolean $hidden Is this field hidden in the form? 30 * @var string $hint Placeholder for the field. 31 * @var string $id DOM id of the field. 32 * @var string $label Label of the field. 33 * @var string $labelclass Classes to apply to the label. 34 * @var boolean $multiple Does this field support multiple values? 35 * @var string $name Name of the input field. 36 * @var string $onchange Onchange attribute for the field. 37 * @var string $onclick Onclick attribute for the field. 38 * @var string $pattern Pattern (Reg Ex) of value of the form field. 39 * @var boolean $readonly Is this field read only? 40 * @var boolean $repeat Allows extensions to duplicate elements. 41 * @var boolean $required Is this field required? 42 * @var integer $size Size attribute of the input. 43 * @var boolean $spellcheck Spellcheck state for the form field. 44 * @var string $validate Validation rules to apply. 45 * @var string $value Value attribute of the field. 46 * @var array $checkedOptions Options that will be set as checked. 47 * @var boolean $hasValue Has this field a value assigned? 48 * @var array $options Options available for this field. 49 * @var array $inputType Options available for this field. 50 * @var boolean $allowCustom Flag, to allow add custom values 51 * @var boolean $remoteSearch Flag, to enable remote search 52 * @var integer $minTermLength Minimum length of the term to start searching 53 * @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output 54 * @var array $dataAttributes Miscellaneous data attributes for eg, data-*. 55 */ 56 57 $html = array(); 58 $attr = ''; 59 60 // Initialize some field attributes. 61 $attr .= $multiple ? ' multiple' : ''; 62 $attr .= $autofocus ? ' autofocus' : ''; 63 $attr .= $onchange ? ' onchange="' . $onchange . '"' : ''; 64 $attr .= $dataAttribute; 65 66 // To avoid user's confusion, readonly="readonly" should imply disabled="disabled". 67 if ($readonly || $disabled) { 68 $attr .= ' disabled="disabled"'; 69 } 70 71 $attr2 = ''; 72 $attr2 .= !empty($class) ? ' class="' . $class . '"' : ''; 73 $attr2 .= ' placeholder="' . $this->escape($hint ?: Text::_('JGLOBAL_TYPE_OR_SELECT_SOME_TAGS')) . '" '; 74 $attr2 .= $dataAttribute; 75 76 if ($allowCustom) { 77 $attr2 .= $allowCustom ? ' allow-custom' : ''; 78 $attr2 .= $allowCustom ? ' new-item-prefix="#new#"' : ''; 79 } 80 81 if ($remoteSearch) { 82 $attr2 .= ' remote-search'; 83 $attr2 .= ' url="' . Uri::root(true) . '/index.php?option=com_tags&task=tags.searchAjax"'; 84 $attr2 .= ' term-key="like"'; 85 $attr2 .= ' min-term-length="' . $minTermLength . '"'; 86 } 87 88 if ($required) { 89 $attr .= ' required class="required"'; 90 $attr2 .= ' required'; 91 } 92 93 // Create a read-only list (no name) with hidden input(s) to store the value(s). 94 if ($readonly) { 95 $html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id); 96 97 // E.g. form field type tag sends $this->value as array 98 if ($multiple && is_array($value)) { 99 if (!count($value)) { 100 $value[] = ''; 101 } 102 103 foreach ($value as $val) { 104 $html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">'; 105 } 106 } else { 107 $html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">'; 108 } 109 } else // Create a regular list. 110 { 111 $html[] = HTMLHelper::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id); 112 } 113 114 Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH'); 115 Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT'); 116 117 Factory::getDocument()->getWebAssetManager() 118 ->usePreset('choicesjs') 119 ->useScript('webcomponent.field-fancy-select'); 120 121 ?> 122 123 <joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |