[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_users 6 * 7 * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Users\Administrator\DataShape; 12 13 use InvalidArgumentException; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('_JEXEC') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Data shape for Method Setup Render Options 21 * 22 * @property string $default_title Default title if you are setting up this MFA Method for the first time 23 * @property string $pre_message Custom HTML to display above the MFA setup form 24 * @property string $table_heading Heading for displayed tabular data. Typically used to display a list of fixed MFA 25 * codes, TOTP setup parameters etc 26 * @property array $tabular_data Any tabular data to display (label => custom HTML). See above 27 * @property array $hidden_data Hidden fields to include in the form (name => value) 28 * @property string $field_type How to render the MFA setup code field. "input" (HTML input element) or "custom" 29 * (custom HTML) 30 * @property string $input_type The type attribute for the HTML input box. Typically "text" or "password". Use any 31 * HTML5 input type. 32 * @property string $input_value Pre-filled value for the HTML input box. Typically used for fixed codes, the fixed 33 * YubiKey ID etc. 34 * @property string $placeholder Placeholder text for the HTML input box. Leave empty if you don't need it. 35 * @property string $label Label to show above the HTML input box. Leave empty if you don't need it. 36 * @property string $html Custom HTML. Only used when field_type = custom. 37 * @property bool $show_submit Should I show the submit button (apply the MFA setup)? 38 * @property string $submit_class Additional CSS classes for the submit button (apply the MFA setup) 39 * @property string $post_message Custom HTML to display below the MFA setup form 40 * @property string $help_url A URL with help content for this Method to display to the user 41 * 42 * @since 4.2.0 43 */ 44 class SetupRenderOptions extends DataShapeObject 45 { 46 /** 47 * Display a standard HTML5 input field. Use the input_type, placeholder and label properties to set it up. 48 * 49 * @since 4.2.0 50 */ 51 public const FIELD_INPUT = 'input'; 52 53 /** 54 * Display a custom HTML document. Use the html property to set it up. 55 * 56 * @since 4.2.0 57 */ 58 public const FIELD_CUSTOM = 'custom'; 59 60 /** 61 * Default title if you are setting up this MFA Method for the first time 62 * 63 * @var string 64 * @since 4.2.0 65 */ 66 protected $default_title = ''; 67 68 /** 69 * Custom HTML to display above the MFA setup form parameters etc 70 * 71 * @var string 72 * @since 4.2.0 73 */ 74 protected $pre_message = ''; 75 76 /** 77 * Heading for displayed tabular data. Typically used to display a list of fixed MFA codes, TOTP setup 78 * 79 * @var string 80 * @since 4.2.0 81 */ 82 protected $table_heading = ''; 83 84 /** 85 * Any tabular data to display (label => custom HTML). See above 86 * 87 * @var array 88 * @since 4.2.0 89 */ 90 protected $tabular_data = []; 91 92 /** 93 * Hidden fields to include in the form (name => value) 94 * 95 * @var array 96 * @since 4.2.0 97 */ 98 protected $hidden_data = []; 99 100 /** 101 * How to render the MFA setup code field. "input" (HTML input element) or "custom" (custom HTML) 102 * 103 * @var string 104 * @since 4.2.0 105 */ 106 protected $field_type = 'input'; 107 108 /** 109 * The type attribute for the HTML input box. Typically "text" or "password". Use any HTML5 input type. 110 * 111 * @var string 112 * @since 4.2.0 113 */ 114 protected $input_type = 'text'; 115 116 /** 117 * Attributes other than type and id which will be added to the HTML input box. 118 * 119 * @var array 120 * @@since 4.2.0 121 */ 122 protected $input_attributes = []; 123 124 /** 125 * Pre-filled value for the HTML input box. Typically used for fixed codes, the fixed YubiKey ID etc. 126 * 127 * @var string 128 * @since 4.2.0 129 */ 130 protected $input_value = ''; 131 132 /** 133 * Placeholder text for the HTML input box. Leave empty if you don't need it. 134 * 135 * @var string 136 * @since 4.2.0 137 */ 138 protected $placeholder = ''; 139 140 /** 141 * Label to show above the HTML input box. Leave empty if you don't need it. 142 * 143 * @var string 144 * @since 4.2.0 145 */ 146 protected $label = ''; 147 148 /** 149 * Custom HTML. Only used when field_type = custom. 150 * 151 * @var string 152 * @since 4.2.0 153 */ 154 protected $html = ''; 155 156 /** 157 * Should I show the submit button (apply the MFA setup)? 158 * 159 * @var boolean 160 * @since 4.2.0 161 */ 162 protected $show_submit = true; 163 164 /** 165 * Additional CSS classes for the submit button (apply the MFA setup) 166 * 167 * @var string 168 * @since 4.2.0 169 */ 170 protected $submit_class = ''; 171 172 /** 173 * Icon class to use for the submit button 174 * 175 * @var string 176 * @since 4.2.0 177 */ 178 protected $submit_icon = 'icon icon-ok'; 179 180 /** 181 * Language key to use for the text on the submit button 182 * 183 * @var string 184 * @since 4.2.0 185 */ 186 protected $submit_text = 'JSAVE'; 187 188 /** 189 * Custom HTML to display below the MFA setup form 190 * 191 * @var string 192 * @since 4.2.0 193 */ 194 protected $post_message = ''; 195 196 /** 197 * A URL with help content for this Method to display to the user 198 * 199 * @var string 200 * @since 4.2.0 201 */ 202 protected $help_url = ''; 203 204 /** 205 * Setter for the field_type property 206 * 207 * @param string $value One of self::FIELD_INPUT, self::FIELD_CUSTOM 208 * 209 * @since 4.2.0 210 * @throws InvalidArgumentException 211 */ 212 // phpcs:ignore 213 protected function setField_type($value) 214 { 215 if (!in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) { 216 throw new InvalidArgumentException('Invalid value for property field_type.'); 217 } 218 219 $this->field_type = $value; 220 } 221 222 /** 223 * Setter for the input_attributes property. 224 * 225 * @param array $value The value to set 226 * 227 * @return void 228 * @since 4.2.0 229 */ 230 // phpcs:ignore 231 protected function setInput_attributes(array $value) 232 { 233 $forbiddenAttributes = ['id', 'type', 'name', 'value']; 234 235 foreach ($forbiddenAttributes as $key) { 236 if (isset($value[$key])) { 237 unset($value[$key]); 238 } 239 } 240 241 $this->input_attributes = $value; 242 } 243 }
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 |