1 layout.context.admin.inc layout_settings_form_context_remove($form, &$form_state)

Submit handler for layout_settings_form() that removes a context.

File

core/modules/layout/layout.context.admin.inc, line 379
Administrative functions for custom layout contexts.

Code

function layout_settings_form_context_remove($form, &$form_state) {
  $removed_context = $form_state['clicked_button']['#array_parents'][3];

  // Find all relationships to this context and remove them too.
  $contexts = $form_state['layout']->getContexts();
  $id = $contexts[$removed_context]->settings['id'];
  $relationships = $form_state['layout']->relationships;
  foreach ($relationships as $key => $relationship) {
    if ($relationship->settings['context_parent'] == 'id:' . $id) {
      unset($form_state['layout']->relationships[$key]);
    }
  }
  // Then finally remove the context.
  $form_state['layout']->clearContexts($removed_context);

  layout_set_layout_tempstore($form_state['layout']);

  $form_state['ajax_update'] = array('context_wrapper');
}