Commit e97d405a authored by Dries's avatar Dries

- Patch #90606 by Neil: node edit type form does not honor 'has title' and 'has body' settings.

parent ab43e83e
......@@ -108,24 +108,25 @@ function node_type_form($type = NULL) {
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if ($type->has_title) {
$form['submission']['title_label'] = array(
'#title' => t('Title field label'),
'#type' => 'textfield',
'#default_value' => $type->title_label,
'#description' => t('The label for the title field of this content type.'),
'#required' => TRUE,
);
}
if ($type->has_body) {
$form['submission']['body_label'] = array(
'#title' => t('Body field label'),
'#type' => 'textfield',
'#default_value' => $type->body_label,
'#description' => t('The label for the body field of this content type.'),
'#required' => TRUE,
);
$form['submission']['title_label'] = array(
'#title' => t('Title field label'),
'#type' => 'textfield',
'#default_value' => $type->title_label,
'#required' => TRUE,
);
if (!$type->has_title) {
// Avoid overwriting a content type that intentionally does not have a
// title field.
$form['submission']['title_label']['#attributes'] = array('disabled' => 'disabled');
$form['submission']['title_label']['#description'] = t('This content type does not have a title field.');
$form['submission']['title_label']['#required'] = FALSE;
}
$form['submission']['body_label'] = array(
'#title' => t('Body field label'),
'#type' => 'textfield',
'#default_value' => $type->body_label,
'#description' => t('To omit the body field for this content type, remove any text and leave this field blank.'),
);
$form['submission']['description'] = array(
'#title' => t('Description'),
'#type' => 'textarea',
......@@ -262,8 +263,12 @@ function node_type_form_submit($form_id, $form_values) {
$type->title_label = $form_values['title_label'];
$type->body_label = $form_values['body_label'];
// title_label is required in core; has_title will always be true, unless a
// module alters the title field.
$type->has_title = ($type->title_label != '');
$type->has_body = ($type->body_label != '');
$type->module = !empty($form_values['module']) ? $form_values['module'] : 'node';
$type->has_title = $type->has_body = TRUE;
$type->custom = $form_values['custom'];
$type->modified = TRUE;
$type->locked = $form_values['locked'];
......
......@@ -2906,6 +2906,7 @@ function node_content_access($op, $node) {
*/
function node_content_form($node) {
$type = node_get_types('type', $node);
$form = array();
if ($type->has_title) {
$form['title'] = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment