[ 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 extract($displayData); 14 15 /** 16 * Layout variables 17 * ----------------- 18 * @var string $autocomplete Autocomplete attribute for the field. 19 * @var boolean $autofocus Is autofocus enabled? 20 * @var string $class Classes for the input. 21 * @var string $description Description of the field. 22 * @var boolean $disabled Is this field disabled? 23 * @var string $group Group the field belongs to. <fields> section in form XML. 24 * @var boolean $hidden Is this field hidden in the form? 25 * @var string $hint Placeholder for the field. 26 * @var string $id DOM id of the field. 27 * @var string $label Label of the field. 28 * @var string $labelclass Classes to apply to the label. 29 * @var boolean $multiple Does this field support multiple values? 30 * @var string $name Name of the input field. 31 * @var string $onchange Onchange attribute for the field. 32 * @var string $onclick Onclick attribute for the field. 33 * @var string $pattern Pattern (Reg Ex) of value of the form field. 34 * @var boolean $readonly Is this field read only? 35 * @var boolean $repeat Allows extensions to duplicate elements. 36 * @var boolean $required Is this field required? 37 * @var integer $size Size attribute of the input. 38 * @var boolean $spellcheck Spellcheck state for the form field. 39 * @var string $validate Validation rules to apply. 40 * @var string $value Value attribute of the field. 41 * @var array $checkedOptions Options that will be set as checked. 42 * @var boolean $hasValue Has this field a value assigned? 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 attributes for eg, data-*. 46 */ 47 48 /** 49 * The format of the input tag to be filled in using sprintf. 50 * %1 - id 51 * %2 - name 52 * %3 - value 53 * %4 = any other attributes 54 */ 55 $format = '<input type="checkbox" id="%1$s" name="%2$s" value="%3$s" %4$s>'; 56 57 // The alt option for Text::alt 58 $alt = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $name); 59 ?> 60 61 <fieldset id="<?php echo $id; ?>" class="<?php echo trim($class . ' checkboxes'); ?>" 62 <?php echo $required ? 'required' : ''; ?> 63 <?php echo $autofocus ? 'autofocus' : ''; ?> 64 <?php echo $dataAttribute; ?>> 65 <legend class="visually-hidden"><?php echo $label; ?></legend> 66 67 <?php foreach ($options as $i => $option) : ?> 68 <?php 69 // Initialize some option attributes. 70 $checked = in_array((string) $option->value, $checkedOptions, true) ? 'checked' : ''; 71 72 // In case there is no stored value, use the option's default state. 73 $checked = (!$hasValue && $option->checked) ? 'checked' : $checked; 74 $optionClass = !empty($option->class) ? 'class="form-check-input ' . $option->class . '"' : ' class="form-check-input"'; 75 $optionDisabled = !empty($option->disable) || $disabled ? 'disabled' : ''; 76 77 // Initialize some JavaScript option attributes. 78 $onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : ''; 79 $onchange = !empty($option->onchange) ? 'onchange="' . $option->onchange . '"' : ''; 80 81 $oid = $id . $i; 82 $value = htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8'); 83 $attributes = array_filter(array($checked, $optionClass, $optionDisabled, $onchange, $onclick)); 84 ?> 85 <div class="form-check form-check-inline"> 86 <?php echo sprintf($format, $oid, $name, $value, implode(' ', $attributes)); ?> 87 <label for="<?php echo $oid; ?>" class="form-check-label"> 88 <?php echo $option->text; ?> 89 </label> 90 </div> 91 <?php endforeach; ?> 92 </fieldset>
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 |