public function HijriDateListWidget::formElement in Hijri 1.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/HijriDateListWidget.php \Drupal\hijri\Plugin\Field\FieldWidget\HijriDateListWidget::formElement()
- 3.0.x src/Plugin/Field/FieldWidget/HijriDateListWidget.php \Drupal\hijri\Plugin\Field\FieldWidget\HijriDateListWidget::formElement()
Define the form for the field type.
Inside this method we can define the form used to edit the field type.
Here there is a list of allowed element types: https://goo.gl/XVd4tA
Overrides DateTimeDatelistWidget::formElement
File
- src/
Plugin/ Field/ FieldWidget/ HijriDateListWidget.php, line 29
Class
- HijriDateListWidget
- Plugin implementation of the 'HijriDateListWidget' widget.
Namespace
Drupal\hijri\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
// @todo We may have to make this range configurable from settings form.
// $element['value']['#date_year_range'] = '1300:1500';
// $element['value']['#date_year_range'] = '-3:+3';
$element['value']['#element_validate'] = [
[
$this,
'validate',
],
];
return $element;
}