You are here

public function AuthmapDeleteLink::buildOptionsForm in External Authentication 2.0.x

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

Overrides LinkBase::buildOptionsForm

File

src/Plugin/views/field/AuthmapDeleteLink.php, line 79

Class

AuthmapDeleteLink
Field handler to present a link to delete an authmap entry.

Namespace

Drupal\externalauth\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {

  // Copy from EntityLinkBase. Maybe unnecessary, but harmless.
  $form['output_url_as_text'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Output the URL as text'),
    '#default_value' => $this->options['output_url_as_text'],
  ];
  $form['absolute'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Use absolute link (begins with "http://")'),
    '#default_value' => $this->options['absolute'],
    '#description' => $this
      ->t('Enable this option to output an absolute link. Required if you want to use the path as a link destination.'),
  ];
  parent::buildOptionsForm($form, $form_state);

  // Only show the 'text' field if we don't want to output the raw URL.
  $form['text']['#states']['visible'][':input[name="options[output_url_as_text]"]'] = [
    'checked' => FALSE,
  ];
}