Index: modules/node/node.css =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.css,v retrieving revision 1.8 diff -u -p -r1.8 node.css --- modules/node/node.css 4 Aug 2009 03:27:11 -0000 1.8 +++ modules/node/node.css 23 Aug 2009 18:20:11 -0000 @@ -21,6 +21,7 @@ td.revision-current { background: #ffc; } +.node-form .form-item .text, .node-form .form-text { display: block; width: 95%; Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1106 diff -u -p -r1.1106 node.module --- modules/node/node.module 23 Aug 2009 01:05:11 -0000 1.1106 +++ modules/node/node.module 23 Aug 2009 18:21:50 -0000 @@ -202,25 +202,6 @@ function node_field_build_modes($obj_typ } /** - * Implement hook_field_extra_fields(). - */ -function node_field_extra_fields($bundle) { - $extra = array(); - - if ($type = node_type_get_type($bundle)) { - if ($type->has_title) { - $extra['title'] = array( - 'label' => $type->title_label, - 'description' => t('Node module element.'), - 'weight' => -5, - ); - } - } - - return $extra; -} - -/** * Gather a listing of links to nodes. * * @param $result @@ -551,6 +532,41 @@ function node_configure_fields($type) { field_delete_instance($instance); } + $field = field_info_field('title_field'); + if (empty($field)) { + $field = array( + 'field_name' => 'title_field', + 'type' => 'text', + ); + $field = field_create_field($field); + } + $instance = field_info_instance('title_field', $type->type); + if (empty($instance)) { + $instance = array( + 'field_name' => 'title_field', + 'bundle' => $type->type, + 'label' => $type->title_label, + 'widget_type' => 'text', + 'weight' => -5, + 'required' => TRUE, + + // With no UI in core, we have to define default + // formatters for the teaser and full view. + // This may change if the method of handling displays + // is changed or if a UI gets into core. + 'display' => array( + 'full' => array( + 'label' => 'hidden', + 'type' => 'hidden', + ), + 'teaser' => array( + 'label' => 'hidden', + 'type' => 'hidden', + ), + ), + ); + field_create_instance($instance); + } } /** @@ -963,6 +979,12 @@ function node_submit($node) { * omitted (or $node->is_new is TRUE), a new node will be added. */ function node_save($node) { + // For performance reasons we need to keep the node.title column, so we have + // to populate it with the title value. The language used is the node language + // as we don't need to care about possible translations in this case. + $language = empty($node->language) ? FIELD_LANGUAGE_NONE : $node->language; + $node->title = $node->title_field[$language][0]['value']; + field_attach_presave('node', $node); // Let modules modify the node before it is saved to the database. module_invoke_all('node_presave', $node); @@ -1261,7 +1283,7 @@ function template_preprocess_node(&$vari $variables['date'] = format_date($node->created); $variables['name'] = theme('username', $node); $variables['node_url'] = url('node/' . $node->nid); - $variables['title'] = check_plain($node->title); + $variables['title'] = check_plain(node_page_title($node)); $variables['page'] = (bool)menu_get_object(); if (!empty($node->in_preview)) { @@ -1853,7 +1875,8 @@ function node_menu() { * Title callback. */ function node_page_title($node) { - return $node->title; + $language = FIELD_LANGUAGE_NONE; + return $node->title_field[$language][0]['value']; } /** @@ -2884,29 +2907,6 @@ function _node_access_rebuild_batch_fini */ /** - * Implement hook_form(). - */ -function node_content_form($node, $form_state) { - - $type = node_type_get_type($node); - - $form = array(); - - if ($type->has_title) { - $form['title'] = array( - '#type' => 'textfield', - '#title' => check_plain($type->title_label), - '#required' => TRUE, - '#default_value' => $node->title, - '#maxlength' => 255, - '#weight' => -5, - ); - } - - return $form; -} - -/** * @} End of "defgroup node_content". */ Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.77 diff -u -p -r1.77 node.pages.inc --- modules/node/node.pages.inc 22 Aug 2009 14:34:20 -0000 1.77 +++ modules/node/node.pages.inc 23 Aug 2009 18:20:11 -0000 @@ -151,7 +151,7 @@ function node_form(&$form_state, $node) if ($extra = node_invoke($node, 'form', $form_state)) { $form = array_merge_recursive($form, $extra); } - if (!isset($form['title']['#weight'])) { + if (!isset($form['title_field']['#weight'])) { $form['title']['#weight'] = -5; }