protected function DateRecurModularWidgetFieldsTrait::getFieldMode in Recurring Date Field Modular Widgets 3.x
Same name and namespace in other branches
- 8 src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldMode()
- 2.x src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldMode()
Get a select element for toggling between common modes.
Modes roughly equate to frequencies.
Parameters
\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item: A date recur field item.
Return value
array A render array.
2 calls to DateRecurModularWidgetFieldsTrait::getFieldMode()
- DateRecurModularAlphaWidget::formElement in src/
Plugin/ Field/ FieldWidget/ DateRecurModularAlphaWidget.php - Returns the form for a single field widget.
- DateRecurModularOscarWidget::formElement in src/
Plugin/ Field/ FieldWidget/ DateRecurModularOscarWidget.php - Returns the form for a single field widget.
File
- src/
DateRecurModularWidgetFieldsTrait.php, line 114
Class
- DateRecurModularWidgetFieldsTrait
- Trait containing convenience methods for generating whole form fields.
Namespace
Drupal\date_recur_modularCode
protected function getFieldMode(DateRecurItem $item) : array {
$modes = $this
->getModes();
return [
'#type' => 'select',
'#title' => $this
->t('Mode'),
'#options' => $modes,
'#default_value' => $this
->getMode($item),
'#access' => count($modes) > 0,
];
}