function ViewExecutable::setHandlerOption

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setHandlerOption()
  2. 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::setHandlerOption()
  3. 11.x 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 2387

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);
}

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