You are here

public function ContactSubtype::buildOptionsForm in CiviCRM Entity 8.3

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

src/Plugin/views/argument_default/ContactSubtype.php, line 82

Class

ContactSubtype
Default argument plugin to extract the current user's civicrm contact subtype

Namespace

Drupal\civicrm_entity\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['no_subtype'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('When logged in user has no contact subtype'),
    '#default_value' => $this->options['no_subtype'],
    '#options' => [
      'none' => $this
        ->t('Show none'),
      'all' => $this
        ->t('Show all'),
    ],
  ];
  $form['multiple_subtype'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('When logged in user has multiple contact subtypes'),
    '#description' => $this
      ->t('Multiple contact subtypes requires multiple values to be set for the contextual filter (see MORE below.)'),
    '#default_value' => $this->options['multiple_subtype'],
    '#options' => [
      'first' => $this
        ->t('Match first'),
      'any' => $this
        ->t('Match any'),
    ],
  ];
}