public function ConfigItem::remove

Submit handler for removing an item from a view

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/ConfigItem.php, line 254
Contains \Drupal\views_ui\Form\Ajax\ConfigItem.

Class

ConfigItem
Provides a form for configuring an item in the Views UI.

Namespace

Drupal\views_ui\Form\Ajax

Code

public function remove(&$form, &$form_state) {

  // Store the item back on the view
  list($was_defaulted, $is_defaulted) = $form_state['view']
    ->getOverrideValues($form, $form_state);
  $executable = $form_state['view']
    ->get('executable');

  // If the display selection was changed toggle the override value.
  if ($was_defaulted != $is_defaulted) {
    $display =& $executable->displayHandlers
      ->get($form_state['display_id']);
    $display
      ->optionsOverride($form, $form_state);
  }
  $executable
    ->removeItem($form_state['display_id'], $form_state['type'], $form_state['id']);

  // Write to cache
  $form_state['view']
    ->cacheSet();
}