[ 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) 2015 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 use Joomla\Utilities\ArrayHelper; 18 19 extract($displayData); 20 21 /** 22 * Layout variables 23 * ----------------- 24 * @var string $autocomplete Autocomplete attribute for the field. 25 * @var boolean $autofocus Is autofocus enabled? 26 * @var string $class Classes for the input. 27 * @var string $description Description of the field. 28 * @var boolean $disabled Is this field disabled? 29 * @var string $group Group the field belongs to. <fields> section in form XML. 30 * @var boolean $hidden Is this field hidden in the form? 31 * @var string $hint Placeholder for the field. 32 * @var string $id DOM id of the field. 33 * @var string $label Label of the field. 34 * @var string $labelclass Classes to apply to the label. 35 * @var boolean $multiple Does this field support multiple values? 36 * @var string $name Name of the input field. 37 * @var string $onchange Onchange attribute for the field. 38 * @var string $onclick Onclick attribute for the field. 39 * @var string $pattern Pattern (Reg Ex) of value of the form field. 40 * @var boolean $readonly Is this field read only? 41 * @var boolean $repeat Allows extensions to duplicate elements. 42 * @var boolean $required Is this field required? 43 * @var integer $size Size attribute of the input. 44 * @var boolean $spellcheck Spellcheck state for the form field. 45 * @var string $validate Validation rules to apply. 46 * @var string $value Value attribute of the field. 47 * @var string $userName The user name 48 * @var mixed $groups The filtering groups (null means no filtering) 49 * @var mixed $excluded The users to exclude from the list of users 50 * @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output 51 * @var array $dataAttributes Miscellaneous data attribute for eg, data-*. 52 */ 53 $modalHTML = ''; 54 $uri = new Uri('index.php?option=com_users&view=users&layout=modal&tmpl=component&required=0'); 55 56 $uri->setVar('field', $this->escape($id)); 57 58 if ($required) { 59 $uri->setVar('required', 1); 60 } 61 62 if (!empty($groups)) { 63 $uri->setVar('groups', base64_encode(json_encode($groups))); 64 } 65 66 if (!empty($excluded)) { 67 $uri->setVar('excluded', base64_encode(json_encode($excluded))); 68 } 69 70 // Invalidate the input value if no user selected 71 if ($this->escape($userName) === Text::_('JLIB_FORM_SELECT_USER')) { 72 $userName = ''; 73 } 74 75 $inputAttributes = array( 76 'type' => 'text', 'id' => $id, 'class' => 'form-control field-user-input-name', 'value' => $this->escape($userName) 77 ); 78 if ($class) { 79 $inputAttributes['class'] .= ' ' . $class; 80 } 81 if ($size) { 82 $inputAttributes['size'] = (int) $size; 83 } 84 if ($required) { 85 $inputAttributes['required'] = 'required'; 86 } 87 if (!$readonly) { 88 $inputAttributes['placeholder'] = Text::_('JLIB_FORM_SELECT_USER'); 89 } 90 91 if (!$readonly) { 92 $modalHTML = HTMLHelper::_( 93 'bootstrap.renderModal', 94 'userModal_' . $id, 95 array( 96 'url' => $uri, 97 'title' => Text::_('JLIB_FORM_CHANGE_USER'), 98 'closeButton' => true, 99 'height' => '100%', 100 'width' => '100%', 101 'modalWidth' => 80, 102 'bodyHeight' => 60, 103 'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('JCANCEL') . '</button>', 104 ) 105 ); 106 107 Factory::getDocument()->getWebAssetManager() 108 ->useScript('webcomponent.field-user'); 109 } 110 ?> 111 <?php // Create a dummy text field with the user name. ?> 112 <joomla-field-user class="field-user-wrapper" 113 url="<?php echo (string) $uri; ?>" 114 modal=".modal" 115 modal-width="100%" 116 modal-height="400px" 117 input=".field-user-input" 118 input-name=".field-user-input-name" 119 button-select=".button-select"> 120 <div class="input-group"> 121 <input <?php echo ArrayHelper::toString($inputAttributes), $dataAttribute; ?> readonly> 122 <?php if (!$readonly) : ?> 123 <button type="button" class="btn btn-primary button-select" title="<?php echo Text::_('JLIB_FORM_CHANGE_USER'); ?>"> 124 <span class="icon-user icon-white" aria-hidden="true"></span> 125 <span class="visually-hidden"><?php echo Text::_('JLIB_FORM_CHANGE_USER'); ?></span> 126 </button> 127 <?php endif; ?> 128 </div> 129 <?php // Create the real field, hidden, that stored the user id. ?> 130 <?php if (!$readonly) : ?> 131 <input type="hidden" id="<?php echo $id; ?>_id" name="<?php echo $name; ?>" value="<?php echo $this->escape($value); ?>" 132 class="field-user-input <?php echo $class ? (string) $class : ''?>" 133 data-onchange="<?php echo $this->escape($onchange); ?>"> 134 <?php echo $modalHTML; ?> 135 <?php endif; ?> 136 </joomla-field-user>
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 |