public function ViewExecutable::removeItem

Removes configuration for a handler instance on a given display.

Parameters

string $display_id: The machine name of the display.

string $type: The type of handler being removed.

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

File

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 2042
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 removeItem($display_id, $type, $id) {

  // Get info about the types so we can get the right data.
  $types = static::viewsHandlerTypes();

  // Initialize the display.
  $this
    ->setDisplay($display_id);

  // Get the existing configuration.
  $fields = $this->displayHandlers
    ->get($display_id)
    ->getOption($types[$type]['plural']);

  // Unset the item.
  unset($fields[$id]);

  // Store.
  $this->displayHandlers
    ->get($display_id)
    ->setOption($types[$type]['plural'], $fields);
}