function ViewExecutable::getHandlers
Same name in other branches
- 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandlers()
- 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandlers()
- 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandlers()
Gets an array of handler instances for the current display.
Parameters
string $type: The type of handlers to retrieve.
string $display_id: (optional) A specific display machine name to use. If NULL, the current display will be used.
Return value
array An array of handler instances of a given type for this display.
File
-
core/
modules/ views/ src/ ViewExecutable.php, line 2299
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\viewsCode
public function getHandlers($type, $display_id = NULL) {
$old_display_id = !empty($this->current_display) ? $this->current_display : 'default';
$this->setDisplay($display_id);
if (!isset($display_id)) {
$display_id = $this->current_display;
}
// Get info about the types so we can get the right data.
$types = static::getHandlerTypes();
$handlers = $this->displayHandlers
->get($display_id)
->getOption($types[$type]['plural']);
// Restore initial display id (if any) or set to 'default'.
if ($display_id != $old_display_id) {
$this->setDisplay($old_display_id);
}
return $handlers;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.