Submit handler for removing an item from a view
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();
}