protected function WizardPluginBase::addDisplays in Views (for Drupal 7) 8.3
Adds the array of display options to the view, with appropriate overrides.
1 call to WizardPluginBase::addDisplays()
- WizardPluginBase::instantiate_view in lib/
Drupal/ views/ Plugin/ views/ wizard/ WizardPluginBase.php - Instantiates a view object from form values.
File
- lib/
Drupal/ views/ Plugin/ views/ wizard/ WizardPluginBase.php, line 622 - Definition of Drupal\views\Plugin\views\wizard\WizardPluginBase.
Class
- WizardPluginBase
- Provides the interface and base class for Views Wizard plugins.
Namespace
Drupal\views\Plugin\views\wizardCode
protected function addDisplays(ViewStorage $view, $display_options, $form, $form_state) {
// Display: Master
$default_display = $view
->newDisplay('default', 'Master', 'default');
foreach ($display_options['default'] as $option => $value) {
$default_display
->setOption($option, $value);
}
// Display: Page
if (isset($display_options['page'])) {
$display = $view
->newDisplay('page', 'Page', 'page_1');
// The page display is usually the main one (from the user's point of
// view). Its options should therefore become the overall view defaults,
// so that new displays which are added later automatically inherit them.
$this
->setDefaultOptions($display_options['page'], $display, $default_display);
// Display: Feed (attached to the page).
if (isset($display_options['feed'])) {
$display = $view
->newDisplay('feed', 'Feed', 'feed_1');
$this
->set_override_options($display_options['feed'], $display, $default_display);
}
}
// Display: Block.
if (isset($display_options['block'])) {
$display = $view
->newDisplay('block', 'Block', 'block_1');
// When there is no page, the block display options should become the
// overall view defaults.
if (!isset($display_options['page'])) {
$this
->setDefaultOptions($display_options['block'], $display, $default_display);
}
else {
$this
->set_override_options($display_options['block'], $display, $default_display);
}
}
}