You are here

public function LinkRegister::buildOptionsForm in RNG - Events and Registrations 8

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

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

Overrides LinkBase::buildOptionsForm

File

src/Plugin/views/field/LinkRegister.php, line 30

Class

LinkRegister
Field handler to present a link to register for an event.

Namespace

Drupal\rng\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $registration_types = [];
  foreach (RegistrationType::loadMultiple() as $registration_type) {
    $registration_types[$registration_type
      ->id()] = $registration_type
      ->label();
  }
  $form['registration_type'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Registration type'),
    '#default_value' => $this->options['registration_type'],
    '#options' => $registration_types,
    '#empty_option' => $this
      ->t('- Display all registration types -'),
  ];
}