function ctools_node_content_type_edit_form
The form to add or edit a node as content.
File
-
plugins/
content_types/ node/ node.inc, line 107
Code
function ctools_node_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_node_title'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($conf['link_node_title']),
'#title' => t('Link the node title to the node'),
'#description' => t('Check this box if you would like your pane title to link to the node.'),
);
if ($form_state['op'] == 'add') {
$form['nid'] = array(
'#prefix' => '<div class="no-float">',
'#title' => t('Enter the title or NID of a node'),
'#description' => t('To use a NID from the URL, you may use %0, %1, ..., %N to get URL arguments. Or use @0, @1, @2, ..., @N to use arguments passed into the panel.'),
'#type' => 'textfield',
'#maxlength' => 512,
'#autocomplete_path' => 'ctools/autocomplete/node',
'#weight' => -10,
'#suffix' => '</div>',
);
}
else {
$form['nid'] = array(
'#type' => 'value',
'#value' => $conf['nid'],
);
}
$form['links'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['links'],
'#title' => t('Include node links for "add comment", "read more" etc.'),
);
$form['identifier'] = array(
'#type' => 'textfield',
'#default_value' => !empty($conf['identifier']) ? $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.'),
);
$entity = entity_get_info('node');
$build_mode_options = array();
foreach ($entity['view modes'] as $mode => $option) {
$build_mode_options[$mode] = $option['label'];
}
// 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;
}