public function ViewExecutable::setItemOption

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

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 2229
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Namespace

Drupal\views

Code

public function setItemOption($display_id, $type, $id, $option, $value) {
  $item = $this
    ->getItem($display_id, $type, $id);
  $item[$option] = $value;
  $this
    ->setItem($display_id, $type, $id, $item);
}