Same name and namespace in other branches
  1. 8.x-2.x src/Plugin/Field/FieldWidget/ColorFieldWidgetBox.php \Drupal\color_field\Plugin\Field\FieldWidget\ColorFieldWidgetBox::settingsForm() 1 comment

File

src/Plugin/Field/FieldWidget/ColorFieldWidgetBox.php, line 27

Class

ColorFieldWidgetBox
Plugin implementation of the color_field box widget.

Namespace

Drupal\color_field\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) : array {
    $element = [];
    $element['default_colors'] = [
        '#type' => 'textarea',
        '#title' => $this->t('Default colors'),
        '#default_value' => $this->getSetting('default_colors'),
        '#required' => TRUE,
        '#element_validate' => [
            [
                $this,
                'settingsColorValidate',
            ],
        ],
        '#description' => $this->t('Default colors for pre-selected color boxes. Enter as 6 digit upper case hex - such as #FF0000.'),
    ];
    return $element;
}