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

Helper function to return a partial context or relationship settings form.

File

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

Code

function layout_context_return_form($form, &$form_state) {
  form_load_include($form_state, 'inc', 'layout', 'layout.context.admin');
  $layout = $form_state['layout'];

  // If no context or relationship has yet been selected, there is no sub-form to display.
  if (!isset($form_state['values']['context']) && !isset($form_state['values']['relationship']) && !isset($form_state['handler'])) {
    return array();
  }

  if (isset($form_state['values']['context'])) {
    $handler = layout_create_context($form_state['values']['context']);
    $handler->is_new = TRUE;
  }
  elseif (isset($form_state['values']['relationship'])) {
    list($plugin_name, $child_delta) = explode(':', $form_state['values']['relationship']);
    $handler = layout_create_handler('layout_relationship', $plugin_name);
    $handler->childDelta = $child_delta;
    $handler->is_new = TRUE;
  }
  else {
    $handler = $form_state['handler'];
  }

  $form_state['layout'] = $layout;
  $form_state['handler'] = $handler;
  $handler->form($form, $form_state);

  return $form;
}