[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   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\Factory;
  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   integer  $size            Size attribute of the input.
  39   * @var   boolean  $spellchec       Spellcheck state for the form field.
  40   * @var   string   $validate        Validation rules to apply.
  41   * @var   string   $value           Value attribute of the field.
  42   * @var   array    $checkedOptions  Options that will be set as checked.
  43   * @var   boolean  $hasValue        Has this field a value assigned?
  44   * @var   array    $options         Options available for this field.
  45   * @var   array    $checked         Is this field checked?
  46   * @var   array    $position        Is this field checked?
  47   * @var   array    $control         Is this field checked?
  48   * @var   string   $dataAttribute   Miscellaneous data attributes preprocessed for HTML output
  49   * @var   array    $dataAttributes  Miscellaneous data attributes for eg, data-*.
  50   */
  51  
  52  if ($validate !== 'color' && in_array($format, array('rgb', 'rgba'), true)) {
  53      $alpha = ($format === 'rgba');
  54      $placeholder = $alpha ? 'rgba(0, 0, 0, 0.5)' : 'rgb(0, 0, 0)';
  55  } else {
  56      $placeholder = '#rrggbb';
  57  }
  58  
  59  $inputclass   = ($keywords && ! in_array($format, array('rgb', 'rgba'), true)) ? ' keywords' : ' ' . $format;
  60  $class        = ' class="form-control ' . trim('minicolors ' . $class) . ($validate === 'color' ? '' : $inputclass) . '"';
  61  $control      = $control ? ' data-control="' . $control . '"' : '';
  62  $format       = $format ? ' data-format="' . $format . '"' : '';
  63  $keywords     = $keywords ? ' data-keywords="' . $keywords . '"' : '';
  64  $colors       = $colors ? ' data-colors="' . $colors . '"' : '';
  65  $validate     = $validate ? ' data-validate="' . $validate . '"' : '';
  66  $disabled     = $disabled ? ' disabled' : '';
  67  $readonly     = $readonly ? ' readonly' : '';
  68  $hint         = strlen($hint) ? ' placeholder="' . $this->escape($hint) . '"' : ' placeholder="' . $placeholder . '"';
  69  $required     = $required ? ' required' : '';
  70  $autocomplete = !empty($autocomplete) ? ' autocomplete="' . $autocomplete . '"' : '';
  71  
  72  // Force LTR input value in RTL, due to display issues with rgba/hex colors
  73  $direction = $lang->isRtl() ? ' dir="ltr" style="text-align:right"' : '';
  74  
  75  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  76  $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
  77  $wa->usePreset('minicolors')
  78      ->useScript('field.color-adv');
  79  ?>
  80  <input type="text" name="<?php echo $name; ?>" id="<?php echo $id; ?>" value="<?php echo $this->escape($color); ?>"<?php
  81      echo $hint,
  82          $class,
  83          $position,
  84          $control,
  85          $readonly,
  86          $disabled,
  87          $required,
  88          $onchange,
  89          $autocomplete,
  90          $autofocus,
  91          $format,
  92          $keywords,
  93          $direction,
  94          $validate,
  95          $dataAttribute;
  96  ?>/>


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