You are here

public function ContextualLinks::buildOptionsForm in Views (for Drupal 7) 8.3

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

Overrides FieldPluginBase::buildOptionsForm

File

lib/Drupal/views/Plugin/views/field/ContextualLinks.php, line 32
Definition of Drupal\views\Plugin\views\field\ContextualLinks.

Class

ContextualLinks
Provides a handler that adds contextual links.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, &$form_state) {
  $all_fields = $this->view->display_handler
    ->getFieldLabels();

  // Offer to include only those fields that follow this one.
  $field_options = array_slice($all_fields, 0, array_search($this->options['id'], array_keys($all_fields)));
  $form['fields'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Fields'),
    '#description' => t('Fields to be included as contextual links.'),
    '#options' => $field_options,
    '#default_value' => $this->options['fields'],
  );
  $form['destination'] = array(
    '#type' => 'select',
    '#title' => t('Include destination'),
    '#description' => t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'),
    '#options' => array(
      '0' => t('No'),
      '1' => t('Yes'),
    ),
    '#default_value' => $this->options['destination'],
  );
}