ViewExecutable::getHandlers

public ViewExecutable::getHandlers($type, $display_id = NULL)

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 2237

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.