function ViewExecutable::getHandler

Same name in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandler()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandler()
  3. 10 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::getHandler()

Gets the configuration of a handler instance on a given display.

Parameters

string $display_id: The machine name of the display.

string $type: The type of handler to retrieve.

string $id: The ID of the handler to retrieve.

Return value

array|null Either the handler instance's configuration, or NULL if the handler is not used on the display.

1 call to ViewExecutable::getHandler()
ViewExecutable::setHandlerOption in core/modules/views/src/ViewExecutable.php
Sets an option on a handler instance.

File

core/modules/views/src/ViewExecutable.php, line 2333

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function getHandler($display_id, $type, $id) {
    // Get info about the types so we can get the right data.
    $types = static::getHandlerTypes();
    // Initialize the display
    $this->setDisplay($display_id);
    // Get the existing configuration
    $fields = $this->displayHandlers
        ->get($display_id)
        ->getOption($types[$type]['plural']);
    return $fields[$id] ?? NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.