Same name and namespace in other branches
- 8.x-2.x src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php \Drupal\color_field\Plugin\Field\FieldFormatter\ColorFieldFormatterText::settingsForm() 1 comment
File
-
src/
Plugin/ Field/ FieldFormatter/ ColorFieldFormatterText.php, line 31
Class
- ColorFieldFormatterText
- Plugin implementation of the color_field text formatter.
Namespace
Drupal\color_field\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) : array {
$opacity = $this->getFieldSetting('opacity');
$elements = [];
$elements['format'] = [
'#type' => 'select',
'#title' => $this->t('Format'),
'#options' => $this->getColorFormat(),
'#default_value' => $this->getSetting('format'),
];
if ($opacity) {
$elements['opacity'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display opacity'),
'#default_value' => $this->getSetting('opacity'),
];
}
return $elements;
}