function panels_common_add_argument_form in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/common-context.inc \panels_common_add_argument_form()
Add the argument table plus gadget plus javascript to the form.
1 call to panels_common_add_argument_form()
- 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 522 - Functions used by more than one panels client module.
Code
function panels_common_add_argument_form($module, &$form, &$form_location, $object) {
$form_location = array(
'#theme' => 'panels_common_context_item_form',
'#panel_name' => $object->name,
'#panels_context_type' => 'argument',
'#panels_context_module' => $module,
);
$form['arguments'] = array(
'#type' => 'value',
'#value' => $object->arguments,
);
// Store the order the choices are in so javascript can manipulate it.
$form['argument_order'] = array(
'#type' => 'hidden',
'#id' => 'argument-order',
'#default_value' => $object->arguments ? implode(',', array_keys($object->arguments)) : '',
);
$args = panels_get_arguments();
$choices = array();
foreach ($args as $name => $arg) {
$choices[$name] = $arg['title'];
}
asort($choices);
if (!empty($choices) || !empty($object->arguments)) {
panels_common_add_item_table('argument', $form_location, $choices, $object->arguments);
}
return _panels_common_context_js($object->name, $module, 'argument');
}