You are here

public function ViewExecutable::setHandlerOption in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setHandlerOption()

Sets an option on a handler instance.

Use this only if you have just 1 or 2 options to set; if you have many, consider getting the handler instance, adding the options and using set_item() directly.

Parameters

string $display_id: The machine name of the display.

string $type: The type of handler being set.

string $id: The ID of the handler being set.

string $option: The configuration key for the value being set.

mixed $value: The value being set.

See also

set_item()

File

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

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function setHandlerOption($display_id, $type, $id, $option, $value) {
  $item = $this
    ->getHandler($display_id, $type, $id);
  $item[$option] = $value;
  $this
    ->setHandler($display_id, $type, $id, $item);
}