[ 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) 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\Language\Text; 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 $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 /** 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="radio" id="%1$s" name="%2$s" value="%3$s" %4$s>'; 56 $alt = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $name); 57 ?> 58 <fieldset id="<?php echo $id; ?>" class="<?php echo trim($class . ' radio'); ?>" 59 <?php echo $disabled ? 'disabled' : ''; ?> 60 <?php echo $required ? 'required' : ''; ?> 61 <?php echo $autofocus ? 'autofocus' : ''; ?> 62 <?php echo $dataAttribute; ?>> 63 64 <?php if (!empty($options)) : ?> 65 <?php foreach ($options as $i => $option) : ?> 66 <?php 67 // Initialize some option attributes. 68 $checked = ((string) $option->value === $value) ? 'checked="checked"' : ''; 69 $optionClass = !empty($option->class) ? 'class="' . $option->class . '"' : ''; 70 $disabled = !empty($option->disable) || ($disabled && !$checked) ? 'disabled' : ''; 71 72 // Initialize some JavaScript option attributes. 73 $onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : ''; 74 $onchange = !empty($option->onchange) ? 'onchange="' . $option->onchange . '"' : ''; 75 $oid = $id . $i; 76 $ovalue = htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8'); 77 $attributes = array_filter(array($checked, $optionClass, $disabled, $onchange, $onclick)); 78 ?> 79 <?php if ($required) : ?> 80 <?php $attributes[] = 'required'; ?> 81 <?php endif; ?> 82 <div class="radio mb-0"> 83 <label for="<?php echo $oid; ?>" <?php echo $optionClass; ?>> 84 <?php echo sprintf($format, $oid, $name, $ovalue, implode(' ', $attributes)); ?> 85 <?php echo Text::alt($option->text, $alt); ?> 86 </label> 87 </div> 88 <?php endforeach; ?> 89 <?php endif; ?> 90 </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 |