function ctools_edit_relationship_form in Chaos Tool Suite (ctools) 6
Form (for ajax use) to add a relationship
1 string reference to 'ctools_edit_relationship_form'
- ctools_context_info in includes/
context-admin.inc - Provide a list of the ways contexts can be embedded.
File
- includes/
context-admin.inc, line 731 - includes/common-context.inc Provide API for adding contexts for modules that embed displays.
Code
function ctools_edit_relationship_form(&$form_state) {
$object = $form_state['object'];
$relationship = $form_state['info'];
$position = $form_state['position'];
$contexts = $form_state['contexts'];
$rel = $object->relationships[$position];
$form['description'] = array(
'#prefix' => '<div class="description">',
'#suffix' => '</div>',
'#value' => check_plain($relationship['description']),
);
// Basic relationship values
$form['relationship']['#tree'] = TRUE;
$form['relationship']['context'] = ctools_context_selector($contexts, $relationship['required context'], isset($rel['context']) ? $rel['context'] : '');
$form['relationship']['name'] = array(
'#type' => 'hidden',
'#value' => $relationship['name'],
);
$form['relationship']['id'] = array(
'#type' => 'hidden',
'#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['next'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}