public function Recipe::buildOptionsForm in Recipe 8.2
Provide a form to edit options for this plugin.
Overrides PathPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ display/ Recipe.php, line 216
Class
- Recipe
- The plugin that handles a recipe format, such as RecipeML.
Namespace
Drupal\recipe\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 'displays':
$form['#title'] .= $this
->t('Attach to');
$displays = [];
foreach ($this->view->storage
->get('display') as $display_id => $display) {
// @todo The display plugin should have display_title and id as well.
if ($this->view->displayHandlers
->has($display_id) && $this->view->displayHandlers
->get($display_id)
->acceptAttachments()) {
$displays[$display_id] = $display['display_title'];
}
}
$form['displays'] = [
'#title' => $this
->t('Displays'),
'#type' => 'checkboxes',
'#description' => $this
->t('The format link will be available only to the selected displays.'),
'#options' => array_map('\\Drupal\\Component\\Utility\\Html::escape', $displays),
'#default_value' => $this
->getOption('displays'),
];
break;
}
}