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

File

src/Plugin/Field/FieldType/ColorFieldType.php, line 37

Class

ColorFieldType
Plugin implementation of the 'color_type' field type.

Namespace

Drupal\color_field\Plugin\Field\FieldType

Code

public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) : array {
    $element = [];
    $element['format'] = [
        '#type' => 'select',
        '#title' => $this->t('Format storage'),
        '#description' => $this->t('Choose how to store the color.'),
        '#default_value' => $this->getSetting('format'),
        '#options' => [
            '#HEXHEX' => $this->t('#123ABC'),
            'HEXHEX' => $this->t('123ABC'),
            '#hexhex' => $this->t('#123abc'),
            'hexhex' => $this->t('123abc'),
        ],
    ];
    return $element + parent::storageSettingsForm($form, $form_state, $has_data);
}