Same name and namespace in other branches
- 8.x-2.x src/Plugin/Field/FieldWidget/ColorFieldWidgetGrid.php \Drupal\color_field\Plugin\Field\FieldWidget\ColorFieldWidgetGrid::settingsForm() 1 comment
File
-
src/
Plugin/ Field/ FieldWidget/ ColorFieldWidgetGrid.php, line 27
Class
- ColorFieldWidgetGrid
- Plugin implementation of the 'color_field_default' widget.
Namespace
Drupal\color_field\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) : array {
$element = [];
$element['cell_width'] = [
'#type' => 'textfield',
'#title' => $this->t('Cell width'),
'#default_value' => $this->getSetting('cell_width'),
'#required' => TRUE,
'#description' => $this->t('Width of each individual color cell.'),
];
$element['cell_height'] = [
'#type' => 'textfield',
'#title' => $this->t('Height width'),
'#default_value' => $this->getSetting('cell_height'),
'#required' => TRUE,
'#description' => $this->t('Height of each individual color cell.'),
];
$element['cell_margin'] = [
'#type' => 'textfield',
'#title' => $this->t('Cell margin'),
'#default_value' => $this->getSetting('cell_margin'),
'#required' => TRUE,
'#description' => $this->t('Margin of each individual color cell.'),
];
$element['box_width'] = [
'#type' => 'textfield',
'#title' => $this->t('Box width'),
'#default_value' => $this->getSetting('box_width'),
'#required' => TRUE,
'#description' => $this->t('Width of the color display box.'),
];
$element['box_height'] = [
'#type' => 'textfield',
'#title' => $this->t('Box height'),
'#default_value' => $this->getSetting('box_height'),
'#required' => TRUE,
'#description' => $this->t('Height of the color display box.'),
];
$element['columns'] = [
'#type' => 'textfield',
'#title' => $this->t('Columns number'),
'#default_value' => $this->getSetting('columns'),
'#required' => TRUE,
'#description' => $this->t('Number of columns to display. Color order may look strange if this is altered.'),
];
return $element;
}