function nd_display_overview_form in Node displays 6
Menu callback; presents a listing of fields display settings for a content type.
Form includes form widgets to select which fields appear for teaser, full node etc and how the field labels should be rendered.
This function is based on content_display_overview_form from content.admin.inc, but altered to have weights and regions.
1 string reference to 'nd_display_overview_form'
- _nd_menu in includes/
nd.registry.inc - Return menu items.
File
- includes/
nd.display.inc, line 17 - Display overview form.
Code
function nd_display_overview_form(&$form_state, $node_type, $build_mode = 'full') {
// Gather information.
$type = node_get_types('type', $node_type);
$nd_display_settings = variable_get('nd_display_settings_' . $node_type, array());
$form = array(
'#tree' => TRUE,
'#node_type' => $node_type,
'#has_body' => $type->has_body,
'#fields' => array(),
'#build_mode' => $build_mode,
);
// Exclude build mode.
$exclude_build_modes = variable_get('nd_buildmodes_exclude', array());
$excluded = isset($exclude_build_modes[$node_type][$build_mode]) && $exclude_build_modes[$node_type][$build_mode] == TRUE || variable_get('nd_contenttype_' . $node_type, FALSE) == TRUE ? TRUE : FALSE;
$form['exclude_build_mode'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude this build mode from rendering.'),
'#description' => t('The node object will still have this build mode property, so you can make exceptions in your template file. You can also change this setting at <a href="@url">the exclude matrix</a>.<br />You can also create a file called <strong>@template.tpl.php</strong> or <strong>@template-nid.tpl.php</strong> to use for templating.', array(
'@url' => url('admin/content/types/nd'),
'@template' => 'node-' . $type->type . '-' . $build_mode,
)),
'#default_value' => $excluded,
'#attributes' => array(
'onClick' => 'toggleFieldOverviewForm()',
),
);
// RSS support.
if ($build_mode == NODE_BUILD_RSS) {
$form['exclude_build_mode']['#description'] = t('If you exclude the RSS build mode, the default node feed is generated, but might render strange content. Make sure you do not choose the "Titles only" as your feed content setting, otherwhise, this screen will not have any effect. Choosing either "Full text" or "Titles + teaser" does not matter, this screen will have effect on both settings, apart from the read more link. Remember that some fields like upload and terms are added automatically to the feed and that this manipulates the $description variable, it does not add extra keys to the feed.');
}
$global_exclude = variable_get('nd_contenttype_' . $node_type, FALSE);
$form['exclude_build_mode']['#disabled'] = $global_exclude;
if ($global_exclude == TRUE) {
$description = t('The checkbox has been disabled because the complete content type has been excluded from rendering.') . '<br />';
$form['exclude_build_mode']['#description'] = $description . ' ' . $form['exclude_build_mode']['#description'];
}
// If global exclude is true, no point in rendering.
if ($global_exclude == FALSE) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['#submit'] = array(
'nd_display_submit',
);
// Add the fields.
nd_add_fields($form, $nd_display_settings);
// Plugins.
if ($build_mode != NODE_BUILD_RSS) {
nd_plugins_display_form($form, $nd_display_settings);
}
}
return $form;
}