[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_users/src/DataShape/ -> CaptiveRenderOptions.php (source)

   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   * @property  string $pre_message         Custom HTML to display above the MFA form
  21   * @property  string $field_type          How to render the MFA code field. "input" or "custom".
  22   * @property  string $input_type          The type attribute for the HTML input box. Typically "text" or "password".
  23   * @property  string $placeholder         Placeholder text for the HTML input box. Leave empty if you don't need it.
  24   * @property  string $label               Label to show above the HTML input box. Leave empty if you don't need it.
  25   * @property  string $html                Custom HTML. Only used when field_type = custom.
  26   * @property  string $post_message        Custom HTML to display below the MFA form
  27   * @property  bool   $hide_submit         Should I hide the default Submit button?
  28   * @property  bool   $allowEntryBatching  Is this method validating against all configured authenticators of this type?
  29   * @property  string $help_url            URL for help content
  30   *
  31   * @since 4.2.0
  32   */
  33  class CaptiveRenderOptions extends DataShapeObject
  34  {
  35      /**
  36       * Display a standard HTML5 input field. Use the input_type, placeholder and label properties to set it up.
  37       *
  38       * @since 4.2.0
  39       */
  40      public const FIELD_INPUT = 'input';
  41  
  42      /**
  43       * Display a custom HTML document. Use the html property to set it up.
  44       *
  45       * @since 4.2.0
  46       */
  47      public const FIELD_CUSTOM = 'custom';
  48  
  49      /**
  50       * Custom HTML to display above the MFA form
  51       *
  52       * @var   string
  53       * @since 4.2.0
  54       */
  55      protected $pre_message = '';
  56  
  57      /**
  58       * How to render the MFA code field. "input" (HTML input element) or "custom" (custom HTML)
  59       *
  60       * @var   string
  61       * @since 4.2.0
  62       */
  63      protected $field_type = 'input';
  64  
  65      /**
  66       * The type attribute for the HTML input box. Typically "text" or "password". Use any HTML5 input type.
  67       *
  68       * @var   string
  69       * @since 4.2.0
  70       */
  71      protected $input_type = '';
  72  
  73      /**
  74       * Attributes other than type and id which will be added to the HTML input box.
  75       *
  76       * @var    array
  77       * @@since 4.2.0
  78       */
  79      protected $input_attributes = [];
  80  
  81      /**
  82       * Placeholder text for the HTML input box. Leave empty if you don't need it.
  83       *
  84       * @var   string
  85       * @since 4.2.0
  86       */
  87      protected $placeholder = '';
  88  
  89      /**
  90       * Label to show above the HTML input box. Leave empty if you don't need it.
  91       *
  92       * @var   string
  93       * @since 4.2.0
  94       */
  95      protected $label = '';
  96  
  97      /**
  98       * Custom HTML. Only used when field_type = custom.
  99       *
 100       * @var   string
 101       * @since 4.2.0
 102       */
 103      protected $html = '';
 104  
 105      /**
 106       * Custom HTML to display below the MFA form
 107       *
 108       * @var   string
 109       * @since 4.2.0
 110       */
 111      protected $post_message = '';
 112  
 113      /**
 114       * Should I hide the default Submit button?
 115       *
 116       * @var   boolean
 117       * @since 4.2.0
 118       */
 119      protected $hide_submit = false;
 120  
 121      /**
 122       * Additional CSS classes for the submit button (apply the MFA setup)
 123       *
 124       * @var   string
 125       * @since 4.2.0
 126       */
 127      protected $submit_class = '';
 128  
 129      /**
 130       * Icon class to use for the submit button
 131       *
 132       * @var    string
 133       * @since 4.2.0
 134       */
 135      protected $submit_icon = 'icon icon-rightarrow icon-arrow-right';
 136  
 137      /**
 138       * Language key to use for the text on the submit button
 139       *
 140       * @var    string
 141       * @since 4.2.0
 142       */
 143      protected $submit_text = 'COM_USERS_MFA_VALIDATE';
 144  
 145      /**
 146       * Is this MFA method validating against all configured authenticators of the same type?
 147       *
 148       * @var   boolean
 149       * @since 4.2.0
 150       */
 151      protected $allowEntryBatching = true;
 152  
 153      /**
 154       * URL for help content
 155       *
 156       * @var   string
 157       * @since 4.2.0
 158       */
 159      protected $help_url = '';
 160  
 161      /**
 162       * Setter for the field_type property
 163       *
 164       * @param   string  $value  One of self::FIELD_INPUT, self::FIELD_CUSTOM
 165       *
 166       * @since   4.2.0
 167       * @throws  InvalidArgumentException
 168       */
 169      // phpcs:ignore
 170      protected function setField_type(string $value)
 171      {
 172          if (!in_array($value, [self::FIELD_INPUT, self::FIELD_CUSTOM])) {
 173              throw new InvalidArgumentException('Invalid value for property field_type.');
 174          }
 175  
 176          $this->field_type = $value;
 177      }
 178  
 179      /**
 180       * Setter for the input_attributes property.
 181       *
 182       * @param   array  $value  The value to set
 183       *
 184       * @return  void
 185       * @@since  4.2.0
 186       */
 187      // phpcs:ignore
 188      protected function setInput_attributes(array $value)
 189      {
 190          $forbiddenAttributes = ['id', 'type', 'name', 'value'];
 191  
 192          foreach ($forbiddenAttributes as $key) {
 193              if (isset($value[$key])) {
 194                  unset($value[$key]);
 195              }
 196          }
 197  
 198          $this->input_attributes = $value;
 199      }
 200  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer