1.20.x layout.context.admin.inc layout_settings_form_context_add($form, &$form_state)

Submit handler for layout_settings_form() that lets the user add a context or relationship.

File

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

Code

function layout_settings_form_context_add($form, &$form_state) {
  // Remove destination flags when adding contexts, otherwise the user will
  // be taken to the destination instead of adding a context. This only
  // affects non-JS behavior.
  if (isset($_GET['destination'])) {
    unset($_GET['destination']);
  }
  if ($form_state['clicked_button']['#name'] === 'relationship_add_button') {
    $form_state['redirect'] = 'admin/structure/layouts/manage/' . $form_state['layout']->name . '/relationship/add';
  }
  else {
    $form_state['redirect'] = 'admin/structure/layouts/manage/' . $form_state['layout']->name . '/context/add';
  }
}