JqueryColorPicker.php in Image Effects 8.2
File
src/Plugin/image_effects/ColorSelector/JqueryColorPicker.php
View source
<?php
namespace Drupal\image_effects\Plugin\image_effects\ColorSelector;
use Drupal\Component\Utility\Unicode;
use Drupal\image_effects\Plugin\ImageEffectsPluginBase;
class JqueryColorPicker extends ImageEffectsPluginBase {
public function selectionElement(array $options = []) {
return [
'#type' => 'jquery_colorpicker',
'#title' => isset($options['#title']) ? $options['#title'] : $this
->t('Color'),
'#default_value' => Unicode::substr($options['#default_value'], -6),
'#attributes' => [
'class' => [
'image-effects-jquery-colorpicker',
],
],
'#wrapper_attributes' => [
'class' => [
'image-effects-jquery-colorpicker-color-selector',
],
],
'#attached' => [
'library' => [
'image_effects/image_effects.jquery_colorpicker_color_selector',
],
],
];
}
public static function isAvailable() {
return \Drupal::service('module_handler')
->moduleExists('jquery_colorpicker');
}
}