class TraceableViewExecutable in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/Views/TraceableViewExecutable.php \Drupal\webprofiler\Views\TraceableViewExecutable
- 8.2 webprofiler/src/Views/TraceableViewExecutable.php \Drupal\webprofiler\Views\TraceableViewExecutable
- 4.x webprofiler/src/Views/TraceableViewExecutable.php \Drupal\webprofiler\Views\TraceableViewExecutable
Class TraceableViewExecutable
Hierarchy
- class \Drupal\views\ViewExecutable
- class \Drupal\webprofiler\Views\TraceableViewExecutable
Expanded class hierarchy of TraceableViewExecutable
1 file declares its use of TraceableViewExecutable
- ViewsDataCollector.php in webprofiler/
src/ DataCollector/ ViewsDataCollector.php
File
- webprofiler/
src/ Views/ TraceableViewExecutable.php, line 12
Namespace
Drupal\webprofiler\ViewsView source
class TraceableViewExecutable extends ViewExecutable {
/**
* @var float
*/
protected $render_time;
/**
* Gets the build time.
*
* @return float
*/
public function getBuildTime() {
return $this->build_time;
}
/**
* Gets the execute time.
*
* @return float
*/
public function getExecuteTime() {
return property_exists($this, 'execute_time') ? $this->execute_time : 0.0;
}
/**
* Gets the render time.
*
* @return float
*/
public function getRenderTime() {
return $this->render_time;
}
/**
* {@inheritdoc}
*/
public function render($display_id = NULL) {
$start = microtime(TRUE);
$this
->execute($display_id);
// Check to see if the build failed.
if (!empty($this->build_info['fail'])) {
return;
}
if (!empty($this->build_info['denied'])) {
return;
}
/** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form */
$exposed_form = $this->display_handler
->getPlugin('exposed_form');
$exposed_form
->preRender($this->result);
$module_handler = \Drupal::moduleHandler();
// @TODO In the longrun, it would be great to execute a view without
// the theme system at all. See https://www.drupal.org/node/2322623.
$active_theme = \Drupal::theme()
->getActiveTheme();
$themes = array_keys($active_theme
->getBaseThemes());
$themes[] = $active_theme
->getName();
// Check for already-cached output.
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
if (!empty($this->live_preview)) {
$cache = Views::pluginManager('cache')
->createInstance('none');
}
else {
$cache = $this->display_handler
->getPlugin('cache');
}
// Run preRender for the pager as it might change the result.
if (!empty($this->pager)) {
$this->pager
->preRender($this->result);
}
// Initialize the style plugin.
$this
->initStyle();
if (!isset($this->response)) {
// Set the response so other parts can alter it.
$this->response = new Response('', 200);
}
// Give field handlers the opportunity to perform additional queries
// using the entire resultset prior to rendering.
if ($this->style_plugin
->usesFields()) {
foreach ($this->field as $id => $handler) {
if (!empty($this->field[$id])) {
$this->field[$id]
->preRender($this->result);
}
}
}
$this->style_plugin
->preRender($this->result);
// Let each area handler have access to the result set.
$areas = [
'header',
'footer',
];
// Only call preRender() on the empty handlers if the result is empty.
if (empty($this->result)) {
$areas[] = 'empty';
}
foreach ($areas as $area) {
foreach ($this->{$area} as $handler) {
$handler
->preRender($this->result);
}
}
// Let modules modify the view just prior to rendering it.
$module_handler
->invokeAll('views_pre_render', [
$this,
]);
// Let the themes play too, because pre render is a very themey thing.
foreach ($themes as $theme_name) {
$function = $theme_name . '_views_pre_render';
if (function_exists($function)) {
$function($this);
}
}
$this->display_handler->output = $this->display_handler
->render();
$exposed_form
->postRender($this->display_handler->output);
$cache
->postRender($this->display_handler->output);
// Let modules modify the view output after it is rendered.
$module_handler
->invokeAll('views_post_render', [
$this,
&$this->display_handler->output,
$cache,
]);
// Let the themes play too, because post render is a very themey thing.
foreach ($themes as $theme_name) {
$function = $theme_name . '_views_post_render';
if (function_exists($function)) {
$function($this, $this->display_handler->output, $cache);
}
}
$this->render_time = microtime(TRUE) - $start;
return $this->display_handler->output;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TraceableViewExecutable:: |
protected | property | ||
TraceableViewExecutable:: |
public | function | Gets the build time. | |
TraceableViewExecutable:: |
public | function | Gets the execute time. | |
TraceableViewExecutable:: |
public | function | Gets the render time. | |
TraceableViewExecutable:: |
public | function |
Render this view for a certain display. Overrides ViewExecutable:: |
|
ViewExecutable:: |
protected | property | Whether this view uses AJAX. | |
ViewExecutable:: |
public | property | Any arguments that have been passed into the view. | |
ViewExecutable:: |
public | property | Stores the argument handlers which are initialized on this view. | |
ViewExecutable:: |
public | property | Attachments to place after the view. | |
ViewExecutable:: |
public | property | Attachments to place before the view. | |
ViewExecutable:: |
protected | property | The entity type of the base table, if available. | |
ViewExecutable:: |
public | property | Allow to override the used database which is used for this query. | |
ViewExecutable:: |
public | property | An array of build info. | |
ViewExecutable:: |
public | property | Indicates if the sorts have been built. | |
ViewExecutable:: |
public | property | Whether or not the view has been built. | |
ViewExecutable:: |
public | property | Identifier of the current display. | |
ViewExecutable:: |
protected | property | The current page. If the view uses pagination. | |
ViewExecutable:: |
public | property | The list of used displays of the view. | |
ViewExecutable:: |
public | property | The current used display plugin. | |
ViewExecutable:: |
public | property | A unique identifier which allows to update multiple views output via js. | |
ViewExecutable:: |
public | property | A render array container to store render related information. | |
ViewExecutable:: |
public | property | Stores the area handlers for the empty text which are initialized on this view. | |
ViewExecutable:: |
public | property | Whether the view has been executed/query has been run. | |
ViewExecutable:: |
public | property | All the form data from $form_state->getValues(). | |
ViewExecutable:: |
protected | property | An array of input values from exposed forms. | |
ViewExecutable:: |
public | property | Exposed widget input directly from the $form_state->getValues(). | |
ViewExecutable:: |
public | property | The rendered output of the exposed form. | |
ViewExecutable:: |
public | property | Feed icons attached to the view. | |
ViewExecutable:: |
public | property | Stores the field handlers which are initialized on this view. | |
ViewExecutable:: |
public | property | Stores the filter handlers which are initialized on this view. | |
ViewExecutable:: |
public | property | Stores the area handlers for the footer which are initialized on this view. | |
ViewExecutable:: |
public | property | Force the query to calculate the total number of results. | |
ViewExecutable:: |
public | property | Stores the area handlers for the header which are initialized on this view. | |
ViewExecutable:: |
public | property | Does this view already have loaded its handlers. | |
ViewExecutable:: |
public | property | Whether this view is an attachment to another view. | |
ViewExecutable:: |
protected | property | The number of items per page. | |
ViewExecutable:: |
public | property | Stores the many-to-one tables for performance. | |
ViewExecutable:: |
protected | property | The pager offset. | |
ViewExecutable:: |
public | property | Used to store views that were previously running if we recurse. | |
ViewExecutable:: |
public | property | Allow to override the path used for generated urls. | |
ViewExecutable:: |
public | property | Allow to override the url of the current view. | |
ViewExecutable:: |
public | property | The used pager plugin used by the current executed view. | |
ViewExecutable:: |
public | property | To avoid recursion in views embedded into areas. | |
ViewExecutable:: |
public | property | If this view has been previewed. | |
ViewExecutable:: |
public | property | Where the $query object will reside. | |
ViewExecutable:: |
public | property | Stores the relationship handlers which are initialized on this view. | |
ViewExecutable:: |
protected | property | Stores the current request object. | |
ViewExecutable:: |
protected | property | Stores the current response object. | |
ViewExecutable:: |
public | property | Where the results of a query will go. | |
ViewExecutable:: |
protected | property | The route provider. | |
ViewExecutable:: |
public | property | The current used row plugin, if the style plugin supports row plugins. | |
ViewExecutable:: |
public | property | Stores the current active row while rendering. | |
ViewExecutable:: |
protected | property | Holds all necessary data for proper unserialization. | |
ViewExecutable:: |
protected | property | Should the admin links be shown on the rendered view. | |
ViewExecutable:: |
public | property | Stores the sort handlers which are initialized on this view. | |
ViewExecutable:: |
public | property | The config entity in which the view is stored. | |
ViewExecutable:: |
public | property | The current used style plugin. | |
ViewExecutable:: |
public | property | The total number of rows returned from the query. | |
ViewExecutable:: |
protected | property | The current user. | |
ViewExecutable:: |
protected | property | The views data. | |
ViewExecutable:: |
public | function | Determines if the given user has access to the view. | |
ViewExecutable:: |
public | function | Expands the list of used cache contexts for the view. | |
ViewExecutable:: |
public | function | Adds an instance of a handler to the view. | |
ViewExecutable:: |
public | function | Determines whether or not AJAX should be used. | |
ViewExecutable:: |
public | function | Runs attachment displays for the view. | |
ViewExecutable:: |
public | function | Builds the query for the view. | |
ViewExecutable:: |
public | function | Builds the render array outline for the given display. | |
ViewExecutable:: |
public | function | Provides a full array of possible theme functions to try for a given hook. | |
ViewExecutable:: |
public | function | Forces the view to build a title. | |
ViewExecutable:: |
public | function | Gets the first display that is accessible to the user. | |
ViewExecutable:: |
public | function | Creates a duplicate ViewExecutable object. | |
ViewExecutable:: |
public | function | Unsets references so that a $view object may be properly garbage collected. | |
ViewExecutable:: |
public | function | Executes the view's query. | |
ViewExecutable:: |
public | function | Executes the given display, with the given arguments. | |
ViewExecutable:: |
public static | function | Generates a unique ID for an handler instance. | |
ViewExecutable:: |
public | function | Returns the entity type of the base table, if available. | |
ViewExecutable:: |
public | function | Creates a list of base tables to be used by the view. | |
ViewExecutable:: |
public | function | Gets the cache tags associated with the executed view. | |
ViewExecutable:: |
public | function | Gets the current page from the pager. | |
ViewExecutable:: |
public | function | Gets dependencies for the view. | |
ViewExecutable:: |
public | function | Gets the current display plugin. | |
ViewExecutable:: |
public | function | Figures out what the exposed input for this view is. | |
ViewExecutable:: |
public | function | Gets the configuration of a handler instance on a given display. | |
ViewExecutable:: |
public | function | Gets an array of handler instances for the current display. | |
ViewExecutable:: |
public static | function | Provides a list of views handler types used in a view. | |
ViewExecutable:: |
public | function | Gets the items per page from the pager. | |
ViewExecutable:: |
public | function | Gets the pager offset from the pager. | |
ViewExecutable:: |
public | function | Gets the current pager plugin. | |
ViewExecutable:: |
public | function | Gets the base path used for this view. | |
ViewExecutable:: |
public static | function | Returns the valid types of plugins that can be used. | |
ViewExecutable:: |
public | function | Gets the current query plugin. | |
ViewExecutable:: |
public | function | Gets the request object. | |
ViewExecutable:: |
public | function | Gets the response object used by the view. | |
ViewExecutable:: |
public | function | Returns whether admin links should be rendered on the view. | |
ViewExecutable:: |
public | function | Gets the current style plugin. | |
ViewExecutable:: |
public | function | Gets the view's current title. | |
ViewExecutable:: |
public | function | Gets the URL for the current view. | |
ViewExecutable:: |
public | function | Gets the Url object associated with the display handler. | |
ViewExecutable:: |
public | function | Gets the current user. | |
ViewExecutable:: |
public | function | Determines if this view has form elements. | |
ViewExecutable:: |
public | function | Determines whether you can link to the view or a particular display. | |
ViewExecutable:: |
public | function | Returns the identifier. | |
ViewExecutable:: |
public | function | Sets the display for this view and initializes the display handler. | |
ViewExecutable:: |
public | function | Acquires and attaches all of the handlers. | |
ViewExecutable:: |
public | function | Initializes the pager. | |
ViewExecutable:: |
public | function | Initializes the query object for the view. | |
ViewExecutable:: |
public | function | Finds and initializes the style plugin. | |
ViewExecutable:: |
public | function | Merges all plugin default values for each display. | |
ViewExecutable:: |
public | function | Creates a new display and a display handler instance for it. | |
ViewExecutable:: |
public | function | Unsets the current view, mostly. | |
ViewExecutable:: |
public | function | Runs attachments and lets the display do what it needs to before running. | |
ViewExecutable:: |
public | function | Previews the given display, with the given arguments. | |
ViewExecutable:: |
public | function | Removes configuration for a handler instance on a given display. | |
ViewExecutable:: |
public | function | Renders the pager, if necessary. | |
ViewExecutable:: |
public | function | Saves the view. | |
ViewExecutable:: |
public | function | Sets whether or not AJAX should be used. | |
ViewExecutable:: |
public | function | Sets the arguments for the view. | |
ViewExecutable:: |
public | function | Sets the current page for the pager. | |
ViewExecutable:: |
public | function | Sets the current display. | |
ViewExecutable:: |
public | function | Sets the exposed filters input to an array. | |
ViewExecutable:: |
public | function | Sets the configuration of a handler instance on a given display. | |
ViewExecutable:: |
public | function | Sets an option on a handler instance. | |
ViewExecutable:: |
public | function | Sets the items per page on the pager. | |
ViewExecutable:: |
public | function | Sets the offset on the pager. | |
ViewExecutable:: |
public | function | Sets the request object. | |
ViewExecutable:: |
public | function | Sets the used response object of the view. | |
ViewExecutable:: |
public | function | Enables admin links on the rendered view. | |
ViewExecutable:: |
public | function | Overrides the view's current title. | |
ViewExecutable:: |
public | function | Determines if the view uses a pager. | |
ViewExecutable:: |
public | function | Makes sure the view is completely valid. | |
ViewExecutable:: |
public | function | Builds an individual set of handlers. | |
ViewExecutable:: |
protected | function | Builds all the arguments. | |
ViewExecutable:: |
protected | function | Attaches the views handler for the specific type. | |
ViewExecutable:: |
protected | function | Runs the postExecute() on all active handlers. | |
ViewExecutable:: |
protected | function | Runs the preQuery() on all active handlers. | |
ViewExecutable:: |
public | function | Constructs a new ViewExecutable object. | |
ViewExecutable:: |
public | function | Magic method implementation to serialize the view executable. | |
ViewExecutable:: |
public | function | Magic method implementation to unserialize the view executable. |