[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/layouts/joomla/form/field/ -> checkbox.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  Layout
   6   *
   7   * @copyright   (C) 2019 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\Form\Field\CheckboxField;
  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|null    $description     Description of the field.
  24   * @var   boolean        $disabled        Is this field disabled?
  25   * @var   CheckboxField  $field           The form field object.
  26   * @var   string|null    $group           Group the field belongs to. <fields> section in form XML.
  27   * @var   boolean        $hidden          Is this field hidden in the form?
  28   * @var   string         $hint            Placeholder for the field.
  29   * @var   string         $id              DOM id of the field.
  30   * @var   string         $label           Label of the field.
  31   * @var   string         $labelclass      Classes to apply to the label.
  32   * @var   boolean        $multiple        Does this field support multiple values?
  33   * @var   string         $name            Name of the input field.
  34   * @var   string         $onchange        Onchange attribute for the field.
  35   * @var   string         $onclick         Onclick attribute for the field.
  36   * @var   string         $pattern         Pattern (Reg Ex) of value of the form field.
  37   * @var   string         $validationtext  The validation text of invalid value of the form field.
  38   * @var   boolean        $readonly        Is this field read only?
  39   * @var   boolean        $repeat          Allows extensions to duplicate elements.
  40   * @var   boolean        $required        Is this field required?
  41   * @var   integer        $size            Size attribute of the input.
  42   * @var   boolean        $spellcheck      Spellcheck state for the form field.
  43   * @var   string         $validate        Validation rules to apply.
  44   * @var   string         $value           Value attribute of the field.
  45   * @var   boolean        $checked         Whether the checkbox should be checked.
  46   * @var   string         $dataAttribute   Miscellaneous data attributes preprocessed for HTML output
  47   * @var   array          $dataAttributes  Miscellaneous data attribute for eg, data-*.
  48   */
  49  
  50  // Initialize some field attributes.
  51  $class     = $class ? ' ' . $class : '';
  52  $disabled  = $disabled ? ' disabled' : '';
  53  $required  = $required ? ' required' : '';
  54  $autofocus = $autofocus ? ' autofocus' : '';
  55  $checked   = $checked ? ' checked' : '';
  56  
  57  // Initialize JavaScript field attributes.
  58  $onclick  = $onclick ? ' onclick="' . $onclick . '"' : '';
  59  $onchange = $onchange ? ' onchange="' . $onchange . '"' : '';
  60  
  61  ?>
  62  <div class="form-check form-check-inline">
  63      <input
  64          type="checkbox"
  65          name="<?php echo $name; ?>"
  66          id="<?php echo $id; ?>"
  67          class="form-check-input<?php echo $class; ?>"
  68          value="<?php echo htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); ?>"
  69          <?php echo $checked . $disabled . $onclick . $onchange . $required . $autofocus . $dataAttribute; ?>
  70      >
  71  </div>


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