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

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
2016-10-29 09:54:20
Comments
Leave a Comment

Please login to continue.