* @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * @var array $displayData Data for this field collected by ColorField */ extract($displayData); /** * Layout variables * ----------------- * @var string $autocomplete Autocomplete attribute for the field. * @var boolean $autofocus Is autofocus enabled? * @var string $class Classes for the input * @var boolean $disabled Is this field disabled? * @var string $display Which kind of slider should be displayed? * @var string $default Default value for this field * @var string $format Format of color value * @var string $hint Text for inputs placeholder * @var string $id ID of field and label * @var string $name Name of the input field * @var string $onchange Onchange attribute for the field * @var string $onclick Onclick attribute for the field * @var string $position Position of input * @var boolean $preview Should the selected value be displayed separately? * @var boolean $readonly Is this field read only? * @var boolean $required Is this field required? * @var string $saveFormat Format to save the color * @var integer $size Size attribute of the input * @var string $validate Validation rules to apply. * @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output * @var array $dataAttributes Miscellaneous data attributes for eg, data-*. */ if ($color === 'none' || is_null($color)) { $color = ''; } $alpha = $format === 'hsla' || $format === 'rgba' || $format === 'alpha'; $autocomplete = !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : ''; $autofocus = $autofocus ? ' autofocus' : ''; $color = ' data-color="' . $color . '"'; $class = $class ? ' class="' . $class . '"' : ''; $default = $default ? ' data-default="' . $default . '"' : ''; $disabled = $disabled ? ' disabled' : ''; $format = $format ? ' data-format="' . $format . '"' : ''; $hint = strlen($hint) ? ' placeholder="' . $this->escape($hint) . '"' : ''; $onchange = $onchange ? ' onchange="' . $onchange . '"' : ''; $onclick = $onclick ? ' onclick="' . $onclick . '"' : ''; $preview = $preview ? ' data-preview="' . $preview . '"' : ''; $readonly = $readonly ? ' readonly' : ''; $saveFormat = $saveFormat ? ' data-format="' . $saveFormat . '"' : ''; $size = $size ? ' size="' . $size . '"' : ''; $validate = $validate ? ' data-validate="' . $validate . '"' : ''; $displayValues = explode(',', $display); $allSliders = $display === 'full' || empty($display); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); $wa->useScript('field.color-slider'); Text::script('JFIELD_COLOR_ERROR_CONVERT_HSL'); Text::script('JFIELD_COLOR_ERROR_CONVERT_HUE'); Text::script('JFIELD_COLOR_ERROR_NO_COLOUR'); Text::script('JFIELD_COLOR_ERROR_WRONG_FORMAT'); ?>
> > > > > > >