You are here

function panels_common_add_required_context_form in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/common.inc \panels_common_add_required_context_form()
1 call to panels_common_add_required_context_form()
panels_mini_context_form in panels_mini/panels_mini.admin.inc
Form to edit the context settings of a mini panel.

File

includes/common-context.inc, line 135
includes/common-context.inc Provide API for adding contexts for modules that embed displays.

Code

function panels_common_add_required_context_form($module, &$form, &$form_state, &$form_location, $object) {
  $form_location = array(
    '#prefix' => '<div id="panels-requiredcontexts-table">',
    '#suffix' => '</div>',
    '#theme' => 'panels_common_context_item_form',
    '#panel_name' => $object->name,
    '#panels_context_type' => 'requiredcontext',
    '#panels_context_module' => $module,
  );

  // Store the order the choices are in so javascript can manipulate it.
  $form_location['markup'] = array(
    '#value' => '&nbsp;',
  );
  $choices = array();
  foreach (panels_get_contexts() as $name => $arg) {
    $choices[$name] = $arg['title'];
  }
  asort($choices);
  if (!empty($choices) || !empty($object->contexts)) {
    panels_common_add_item_table('requiredcontext', $form_location, $choices, $object->requiredcontexts);
  }
}