You are here

function panels_common_add_relationship_form in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/common-context.inc \panels_common_add_relationship_form()
3 calls to panels_common_add_relationship_form()
panels_mini_context_form in panels_mini/panels_mini.module
Form to edit the context settings of a mini panel.
panels_node_context_form in panels_node/panels_node.module
The form to edit the context settings of a panel node.
panels_page_context_form in panels_page/panels_page.admin.inc
The form to edit the context settings of a panel page.

File

includes/common.inc, line 634
Functions used by more than one panels client module.

Code

function panels_common_add_relationship_form($module, &$form, &$form_location, $object) {
  $form['relationships'] = array(
    '#type' => 'value',
    '#value' => $object->relationships,
  );
  $form_location = array(
    '#prefix' => '<div id="panels-relationships-table">',
    '#suffix' => '</div>',
    '#theme' => 'panels_common_context_item_form',
    '#panel_name' => $object->name,
    '#panels_context_type' => 'relationship',
    '#panels_context_module' => $module,
  );

  // Store the order the choices are in so javascript can manipulate it.
  $form_location['markup'] = array(
    '#value' => '&nbsp;',
  );
  $form['relationship_order'] = array(
    '#type' => 'hidden',
    '#id' => 'relationship-order',
    '#default_value' => $object->relationships ? implode(',', array_keys($object->relationships)) : '',
  );
  $available_relationships = panels_get_relevant_relationships(panels_context_load_contexts($object));

  //  if (!empty($available_relationships) || !empty($object->relationships)) {
  panels_common_add_item_table('relationship', $form_location, $available_relationships, $object->relationships);

  //  }
  return _panels_common_context_js($object->name, $module, 'relationship');
}