diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 42d968de8b28115532f1954537b256fae5be300d..97f6a0baf39bc0417f04538542addf134599397f 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -174,6 +174,11 @@ function node_theme() { 'node_recent_content' => array( 'variables' => array('node' => NULL), ), + 'layout_form_3' => array( + 'render element' => 'form', + 'path' => 'core/modules/system/layouts', + 'template' => 'layout-form-3', + ), ); } @@ -1429,6 +1434,20 @@ function template_preprocess_node(&$variables) { } /** + * Process variables for layout-form-3.tpl.php + */ +function template_preprocess_layout_form_3(&$variables) { + $form = $variables['form']; + + // Build rendered layout parts for template + $variables['layout'] = array( + 'secondary' => drupal_render($form['additional_settings']), + 'actions' => drupal_render($form['actions']), + 'main' => drupal_render_children($form), + ); +} + +/** * Implements hook_permission(). */ function node_permission() { diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index faa3deade74fb785bb5656ca11eb5934a9909691..2ca1792fc8d86cc04971c8786cb81346b4e0aca7 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -152,6 +152,9 @@ function node_form($form, &$form_state, Node $node) { unset($node->in_preview); } + // Use a three-region form layout by default. + $form['#theme'] = array('layout_form_3'); + // Override the default CSS class name, since the user-defined node type name // in 'TYPE-node-form' potentially clashes with third-party class names. $form['#attributes']['class'][0] = drupal_html_class('node-' . $node->type . '-form'); @@ -170,6 +173,7 @@ function node_form($form, &$form_state, Node $node) { '#type' => 'hidden', '#default_value' => isset($node->changed) ? $node->changed : NULL, ); + // Invoke hook_form() to get the node-specific bits. Can't use node_invoke(), // because hook_form() needs to be able to receive $form_state by reference. // @todo hook_form() implementations are unable to add #validate or #submit @@ -178,11 +182,13 @@ function node_form($form, &$form_state, Node $node) { if (function_exists($function) && ($extra = $function($node, $form_state))) { $form = array_merge_recursive($form, $extra); } + // If the node type has a title, and the node type form defined no special // weight for it, we default to a weight of -5 for consistency. if (isset($form['title']) && !isset($form['title']['#weight'])) { $form['title']['#weight'] = -5; } + // @todo D8: Remove. Modules should access the node using $form_state['node']. $form['#node'] = $node; @@ -209,7 +215,7 @@ function node_form($form, &$form_state, Node $node) { } $form['additional_settings'] = array( - '#type' => 'vertical_tabs', + '#type' => 'fieldset', '#weight' => 99, ); @@ -237,6 +243,7 @@ function node_form($form, &$form_state, Node $node) { '#default_value' => $node->revision, '#access' => user_access('administer nodes'), ); + // Check the revision log checkbox when the log textarea is filled in. // This must not happen if "Create new revision" is enabled by default, since // the state would auto-disable the checkbox otherwise. diff --git a/core/modules/system/layouts/layout-form-3.tpl.php b/core/modules/system/layouts/layout-form-3.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..297afb85d327cabe3f1a2230a6206b5d7955b04c --- /dev/null +++ b/core/modules/system/layouts/layout-form-3.tpl.php @@ -0,0 +1,26 @@ + +