You are here

protected function DateRecurModularWidgetFieldsTrait::getFieldEndsMode in Recurring Date Field Modular Widgets 3.x

Same name and namespace in other branches
  1. 8 src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldEndsMode()
  2. 2.x src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldEndsMode()

Get an radios element for toggling between common end modes.

Return value

array A render array.

1 call to DateRecurModularWidgetFieldsTrait::getFieldEndsMode()
DateRecurModularAlphaWidget::formElement in src/Plugin/Field/FieldWidget/DateRecurModularAlphaWidget.php
Returns the form for a single field widget.

File

src/DateRecurModularWidgetFieldsTrait.php, line 131

Class

DateRecurModularWidgetFieldsTrait
Trait containing convenience methods for generating whole form fields.

Namespace

Drupal\date_recur_modular

Code

protected function getFieldEndsMode() : array {
  return [
    '#type' => 'radios',
    '#title' => $this
      ->t('Ends'),
    '#options' => [
      DateRecurModularWidgetOptions::ENDS_MODE_INFINITE => $this
        ->t('Never'),
      DateRecurModularWidgetOptions::ENDS_MODE_OCCURRENCES => $this
        ->t('After number of occurrences'),
      DateRecurModularWidgetOptions::ENDS_MODE_ON_DATE => $this
        ->t('On date'),
    ],
  ];
}