You are here

public function EventDateStringField::buildOptionsForm in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/field/EventDateStringField.php \Drupal\rng\Plugin\views\field\EventDateStringField::buildOptionsForm()

Default options form that provides the label widget that all fields should have.

Overrides Date::buildOptionsForm

File

src/Plugin/views/field/EventDateStringField.php, line 167

Class

EventDateStringField
A handler to provide a field that is completely custom by the administrator.

Namespace

Drupal\rng\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $bundles = $this->eventManager
    ->eventTypeWithEntityType($this->configuration['entity_type']);
  $options = [];
  foreach ($bundles as $k => $v) {
    [
      $content_type,
      $bundle,
    ] = explode('.', $k);
    $options[$bundle] = $bundle;
  }
  $form['entity_bundle'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Select the @event type defining the date field to use.', [
      '@event' => $content_type,
    ]),
    '#default_value' => $this->options['entity_bundle'],
    '#options' => $options,
  ];
  parent::buildOptionsForm($form, $form_state);
}