function ctools_node_content_content_type_edit_form in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 plugins/content_types/node_context/node_content.inc \ctools_node_content_content_type_edit_form()
Returns an edit form for the custom type.
File
- plugins/
content_types/ node_context/ node_content.inc, line 133
Code
function ctools_node_content_content_type_edit_form(&$form, &$form_state) {
$conf = $form_state['conf'];
$form['leave_node_title'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($conf['leave_node_title']),
'#title' => t('Leave node title'),
'#description' => t('Advanced: if checked, do not touch the node title; this can cause the node title to appear twice unless your theme is aware of this.'),
);
$form['link'] = array(
'#title' => t('Link title to node'),
'#type' => 'checkbox',
'#default_value' => $conf['link'],
'#description' => t('Check here to make the title link to the node.'),
);
$form['page'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['page'],
'#title' => t('Treat this as the primary node page'),
'#description' => t('This can affect title rendering and breadcrumbs from some node types.'),
);
$form['links'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['links'],
'#title' => t('Include node links for "add comment", "read more" etc.'),
);
$form['no_extras'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['no_extras'],
'#title' => t('No extras'),
'#description' => t('Check here to disable additions that modules might make to the node, such as file attachments and CCK fields; this should just display the basic teaser or body.'),
);
$form['identifier'] = array(
'#type' => 'textfield',
'#default_value' => $conf['identifier'],
'#title' => t('Template identifier'),
'#description' => t('This identifier will be added as a template suggestion to display this node: node-panel-IDENTIFIER.tpl.php. Please see the Drupal theming guide for information about template suggestions.'),
);
// CCK holds the registry of available build modes, but can hardly
// push them as options for the build mode options, so we break the normal
// rule of not directly relying on non-core modules.
if ($modes = module_invoke('content', 'build_modes')) {
$build_mode_options = array();
foreach ($modes as $key => $value) {
if (isset($value['views style']) && $value['views style']) {
$build_mode_options[$key] = $value['title'];
}
}
}
else {
$build_mode_options = array(
'teaser' => t('Teaser'),
'full' => t('Full node'),
);
}
// Handle existing configurations with the deprecated 'teaser' option.
// Also remove the teaser key from the form_state.
if (isset($conf['teaser']) || !isset($conf['build_mode'])) {
unset($form_state['conf']['teaser']);
$conf['build_mode'] = $conf['teaser'] ? 'teaser' : 'full';
}
$form['build_mode'] = array(
'#title' => t('Build mode'),
'#type' => 'select',
'#description' => t('Select a build mode for this node.'),
'#options' => $build_mode_options,
'#default_value' => $conf['build_mode'],
);
return $form;
}