You are here

public function EntityBrowserWidgetContext::buildOptionsForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/argument_default/EntityBrowserWidgetContext.php \Drupal\entity_browser\Plugin\views\argument_default\EntityBrowserWidgetContext::buildOptionsForm()

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

src/Plugin/views/argument_default/EntityBrowserWidgetContext.php, line 61

Class

EntityBrowserWidgetContext
The entity browser widget context argument default handler.

Namespace

Drupal\entity_browser\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['context_key'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Context key'),
    '#description' => $this
      ->t('The key within the widget context.'),
    '#default_value' => $this->options['context_key'],
  ];
  $form['fallback'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Fallback value'),
    '#description' => $this
      ->t('The fallback value to use when the context is not present. (ex: "all")'),
    '#default_value' => $this->options['fallback'],
  ];
  $form['multiple'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Multiple values'),
    '#description' => $this
      ->t('Conjunction to use when handling multiple values. NOTE: for multiple values to work, at the bottom of this form expand the "More" fieldset and and check "Allow multiple values".'),
    '#default_value' => $this->options['multiple'],
    '#options' => [
      'or' => $this
        ->t('OR'),
      'and' => $this
        ->t('AND'),
    ],
  ];
}