function panels_common_edit_relationship_form in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/common-context.inc \panels_common_edit_relationship_form()
Form (for ajax use) to add a relationship
File
- includes/
common.inc, line 1223 - Functions used by more than one panels client module.
Code
function panels_common_edit_relationship_form($panel_page, $relationship, $position, $contexts) {
$rel = $panel_page->relationships[$position];
$form['position'] = array(
'#type' => 'hidden',
'#value' => $position,
);
$form['start_form'] = array(
'#value' => '<div class="modal-form clear-block">',
);
$form['description'] = array(
'#prefix' => '<div class="description">',
'#suffix' => '</div>',
'#value' => check_plain($relationship['description']),
);
// Basic relationship values
$form['relationship']['#tree'] = TRUE;
$form['relationship']['context'] = panels_context_selector($contexts, $relationship['required context'], $rel['context']);
$form['relationship']['name'] = array(
'#type' => 'hidden',
'#value' => $relationship['name'],
);
$form['relationship']['id'] = array(
'#type' => 'value',
'#value' => $rel['id'],
);
$form['relationship']['identifier'] = array(
'#type' => 'textfield',
'#title' => t('Identifier'),
'#description' => t('Enter a name to identify this !type on administrative screens.', array(
'!type' => t('relationship'),
)),
'#default_value' => $rel['identifier'],
);
$form['relationship']['keyword'] = array(
'#type' => 'textfield',
'#title' => t('Keyword'),
'#description' => t('Enter a keyword to use for substitution in titles.'),
'#default_value' => $rel['keyword'],
);
// Settings particular to this relationship
$relationship_settings = array();
if (isset($rel['relationship_settings'])) {
$relationship_settings = $rel['relationship_settings'];
}
if (isset($relationship['settings form']) && function_exists($relationship['settings form'])) {
$form['relationship']['relationship_settings'] = $relationship['settings form']($relationship_settings);
$form['relationship']['relationship_settings']['#tree'] = TRUE;
}
$form['relationship_info'] = array(
'#type' => 'value',
'#value' => $relationship,
);
$form['end_form'] = array(
'#value' => '</div>',
);
$form['next'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}