public function Attachment::buildOptionsForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/display/Attachment.php \Drupal\views\Plugin\views\display\Attachment::buildOptionsForm()
Provide the default form for setting options.
Overrides DisplayPluginBase::buildOptionsForm
File
- core/
modules/ views/ src/ Plugin/ views/ display/ Attachment.php, line 143 - Contains \Drupal\views\Plugin\views\display\Attachment.
Class
- Attachment
- The plugin that handles an attachment display.
Namespace
Drupal\views\Plugin\views\displayCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
// It is very important to call the parent function here:
parent::buildOptionsForm($form, $form_state);
switch ($form_state
->get('section')) {
case 'inherit_arguments':
$form['#title'] .= $this
->t('Inherit contextual filters');
$form['inherit_arguments'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Inherit'),
'#description' => $this
->t('Should this display inherit its contextual filter values from the parent display to which it is attached?'),
'#default_value' => $this
->getOption('inherit_arguments'),
);
break;
case 'inherit_exposed_filters':
$form['#title'] .= $this
->t('Inherit exposed filters');
$form['inherit_exposed_filters'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Inherit'),
'#description' => $this
->t('Should this display inherit its exposed filter values from the parent display to which it is attached?'),
'#default_value' => $this
->getOption('inherit_exposed_filters'),
);
break;
case 'inherit_pager':
$form['#title'] .= $this
->t('Inherit pager');
$form['inherit_pager'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Inherit'),
'#description' => $this
->t('Should this display inherit its paging values from the parent display to which it is attached?'),
'#default_value' => $this
->getOption('inherit_pager'),
);
break;
case 'render_pager':
$form['#title'] .= $this
->t('Render pager');
$form['render_pager'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Render'),
'#description' => $this
->t('Should this display render the pager values? This is only meaningful if inheriting a pager.'),
'#default_value' => $this
->getOption('render_pager'),
);
break;
case 'attachment_position':
$form['#title'] .= $this
->t('Position');
$form['attachment_position'] = array(
'#title' => $this
->t('Position'),
'#type' => 'radios',
'#description' => $this
->t('Attach before or after the parent display?'),
'#options' => $this
->attachmentPositions(),
'#default_value' => $this
->getOption('attachment_position'),
);
break;
case 'displays':
$form['#title'] .= $this
->t('Attach to');
$displays = array();
foreach ($this->view->storage
->get('display') as $display_id => $display) {
if ($this->view->displayHandlers
->has($display_id) && $this->view->displayHandlers
->get($display_id)
->acceptAttachments()) {
$displays[$display_id] = $display['display_title'];
}
}
$form['displays'] = array(
'#title' => $this
->t('Displays'),
'#type' => 'checkboxes',
'#description' => $this
->t('Select which display or displays this should attach to.'),
'#options' => array_map('\\Drupal\\Component\\Utility\\Html::escape', $displays),
'#default_value' => $this
->getOption('displays'),
);
break;
}
}