public function Farbtastic::selectionElement in Image Effects 8
Same name and namespace in other branches
- 8.3 src/Plugin/image_effects/ColorSelector/Farbtastic.php \Drupal\image_effects\Plugin\image_effects\ColorSelector\Farbtastic::selectionElement()
- 8.2 src/Plugin/image_effects/ColorSelector/Farbtastic.php \Drupal\image_effects\Plugin\image_effects\ColorSelector\Farbtastic::selectionElement()
Return a form element to select the plugin content.
Parameters
array $options: (Optional) An array of additional Form API keys and values.
Return value
array Render array of the form element.
Overrides ImageEffectsPluginBase::selectionElement
File
- src/
Plugin/ image_effects/ ColorSelector/ Farbtastic.php, line 22
Class
- Farbtastic
- Farbtastic color selector plugin.
Namespace
Drupal\image_effects\Plugin\image_effects\ColorSelectorCode
public function selectionElement(array $options = []) {
return [
'#type' => 'textfield',
'#title' => isset($options['#title']) ? $options['#title'] : $this
->t('Color'),
'#description' => isset($options['#description']) ? $options['#description'] : NULL,
'#default_value' => $options['#default_value'],
'#field_suffix' => '<div class="farbtastic-colorpicker"></div>',
'#maxlength' => 7,
'#size' => 7,
'#wrapper_attributes' => [
'class' => [
'image-effects-farbtastic-color-selector',
],
],
'#attributes' => [
'class' => [
'image-effects-color-textfield',
],
],
'#attached' => [
'library' => [
'image_effects/image_effects.farbtastic_color_selector',
],
],
];
}