function ctools_content_form in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/content.inc \ctools_content_form()
Get the config form.
The $form_info and $form_state need to be preconfigured with data you'll need such as whether or not you're using ajax, or the modal. $form_info will need your next/submit callbacks so that you can cache your data appropriately.
Return value
If this function returns false, no form exists.
File
- includes/
content.inc, line 567 - Contains the tools to handle pluggable content that can be used by other applications such as Panels or Dashboard.
Code
function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_name, $subtype, &$conf, $step = NULL) {
$form_state += array(
'plugin' => $plugin,
'subtype' => $subtype,
'subtype_name' => $subtype_name,
'conf' => &$conf,
'op' => $op,
);
$form_info += array(
'id' => 'ctools_content_form',
'show back' => TRUE,
);
// Turn the forms defined in the plugin into the format the wizard needs.
if ($op == 'add') {
if (!empty($subtype['add form'])) {
_ctools_content_create_form_info($form_info, $subtype['add form'], $subtype, $subtype, $op);
}
else {
if (!empty($plugin['add form'])) {
_ctools_content_create_form_info($form_info, $plugin['add form'], $plugin, $subtype, $op);
}
}
}
if (empty($form_info['order'])) {
// Use the edit form for the add form if add form was completely left off.
if (!empty($subtype['edit form'])) {
_ctools_content_create_form_info($form_info, $subtype['edit form'], $subtype, $subtype, $op);
}
else {
if (!empty($plugin['edit form'])) {
_ctools_content_create_form_info($form_info, $plugin['edit form'], $plugin, $subtype, $op);
}
}
}
if (empty($form_info['order'])) {
return FALSE;
}
ctools_include('wizard');
return ctools_wizard_multistep_form($form_info, $step, $form_state);
}