public function ContextualLinks::buildOptionsForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/contextual/src/Plugin/views/field/ContextualLinks.php \Drupal\contextual\Plugin\views\field\ContextualLinks::buildOptionsForm()
Default options form that provides the label widget that all fields should have.
Overrides FieldPluginBase::buildOptionsForm
File
- core/
modules/ contextual/ src/ Plugin/ views/ field/ ContextualLinks.php, line 52 - Contains \Drupal\contextual\Plugin\views\field\ContextualLinks.
Class
- ContextualLinks
- Provides a handler that adds contextual links.
Namespace
Drupal\contextual\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $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' => $this
->t('Fields'),
'#description' => $this
->t('Fields to be included as contextual links.'),
'#options' => $field_options,
'#default_value' => $this->options['fields'],
);
$form['destination'] = array(
'#type' => 'select',
'#title' => $this
->t('Include destination'),
'#description' => $this
->t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'),
'#options' => array(
'0' => $this
->t('No'),
'1' => $this
->t('Yes'),
),
'#default_value' => $this->options['destination'],
);
}