class DefaultDisplay
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/display/DefaultDisplay.php \Drupal\views\Plugin\views\display\DefaultDisplay
- 10 core/modules/views/src/Plugin/views/display/DefaultDisplay.php \Drupal\views\Plugin\views\display\DefaultDisplay
- 8.9.x core/modules/views/src/Plugin/views/display/DefaultDisplay.php \Drupal\views\Plugin\views\display\DefaultDisplay
A plugin to handle defaults on a view.
Plugin annotation
@ViewsDisplay(
id = "default",
title = @Translation("Default"),
help = @Translation("Default settings for this view."),
theme = "views_view",
no_ui = TRUE
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\display\DisplayPluginBase implements \Drupal\views\Plugin\views\display\DisplayPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface uses \Drupal\Core\Plugin\PluginDependencyTrait extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\display\DefaultDisplay extends \Drupal\views\Plugin\views\display\DisplayPluginBase
- class \Drupal\views\Plugin\views\display\DisplayPluginBase implements \Drupal\views\Plugin\views\display\DisplayPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface uses \Drupal\Core\Plugin\PluginDependencyTrait extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of DefaultDisplay
Related topics
1 file declares its use of DefaultDisplay
- ViewExecutableTest.php in core/
modules/ views/ tests/ src/ Kernel/ ViewExecutableTest.php
File
-
core/
modules/ views/ src/ Plugin/ views/ display/ DefaultDisplay.php, line 18
Namespace
Drupal\views\Plugin\views\displayView source
class DefaultDisplay extends DisplayPluginBase {
/**
* Whether the display allows attachments.
*
* @var bool
*/
protected $usesAttachments = TRUE;
/**
* Determine if this display is the default which contains fallback settings.
*/
public function isDefaultDisplay() {
return TRUE;
}
/**
* The default execute handler fully renders the view.
*
* For the simplest use:
* @code
* $output = $view->executeDisplay('default', $args);
* @endcode
*
* For more complex usages, a view can be partially built:
* @code
* $view->setArguments($args);
* $view->build('default'); // Build the query
* $view->preExecute(); // Pre-execute the query.
* $view->execute(); // Run the query
* $output = $view->render(); // Render the view
* @endcode
*
* If short circuited at any point, look in $view->build_info for
* information about the query. After execute, look in $view->result
* for the array of objects returned from \Drupal::database()->query().
*
* You can also do:
* @code
* $view->setArguments($args);
* $output = $view->render('default'); // Render the view
* @endcode
*
* This illustrates that render is smart enough to call build and execute
* if these items have not already been accomplished.
*
* Note that execute also must accomplish other tasks, such as setting page
* titles, and generating exposed filter data if necessary.
*/
public function execute() {
return $this->view
->render($this->display['id']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.