diff --git a/core/includes/common.inc b/core/includes/common.inc index b78b7f3..edd61b7 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -6466,7 +6466,7 @@ function element_set_attributes(array &$element, array $map) { $property = '#' . $attribute; } // Do not overwrite already existing attributes. - if (isset($element[$property]) && !isset($element['#attributes'][$attribute])) { + if (isset($element[$property]) && !empty($element[$property]) && !isset($element['#attributes'][$attribute])) { $element['#attributes'][$attribute] = $element[$property]; } } diff --git a/core/includes/form.inc b/core/includes/form.inc index c94bc62..4220685 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -3686,6 +3686,9 @@ function form_pre_render_fieldset($element) { if (!empty($element['#collapsed'])) { $element['#attributes']['class'][] = 'collapsed'; } + else { + $element['#attributes']['class'][] = 'expanded'; + } } // Fieldsets may be rendered outside of a Form API context. @@ -4383,33 +4386,37 @@ function theme_form_element($variables) { $prefix = isset($element['#field_prefix']) ? '' . $element['#field_prefix'] . ' ' : ''; $suffix = isset($element['#field_suffix']) ? ' ' . $element['#field_suffix'] . '' : ''; + $description = ''; + if (!empty($element['#description'])) { + $attributes = array('class' => 'description'); + if (!empty($element['#id'])) { + $attributes['id'] = $element['#id'] . '--description'; + } + $description .= '' . $element['#description'] . "\n"; + } + switch ($element['#title_display']) { case 'before': case 'invisible': $output .= ' ' . theme('form_element_label', $variables); + $output .= ' ' . $description; $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; break; case 'after': $output .= ' ' . $prefix . $element['#children'] . $suffix; $output .= ' ' . theme('form_element_label', $variables) . "\n"; + $output .= ' ' . $description; break; case 'none': case 'attribute': // Output no label and no required marker, only the children. $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; + $output .= ' ' . $description; break; } - if (!empty($element['#description'])) { - $attributes = array('class' => 'description'); - if (!empty($element['#id'])) { - $attributes['id'] = $element['#id'] . '--description'; - } - $output .= '' . $element['#description'] . "\n"; - } - $output .= "\n"; return $output; diff --git a/core/misc/collapse.js b/core/misc/collapse.js index b484a6f..b79bf5b 100644 --- a/core/misc/collapse.js +++ b/core/misc/collapse.js @@ -11,6 +11,7 @@ Drupal.toggleFieldset = function (fieldset) { var $content = $fieldset.find('> .fieldset-wrapper').hide(); $fieldset .removeClass('collapsed') + .addClass('expanded') .trigger({ type: 'collapsed', value: false }) .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide')); $content.slideDown({ @@ -30,6 +31,7 @@ Drupal.toggleFieldset = function (fieldset) { $fieldset.trigger({ type: 'collapsed', value: true }); $fieldset.find('> .fieldset-wrapper').slideUp('fast', function () { $fieldset + .removeClass('expanded') .addClass('collapsed') .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show')); fieldset.animating = false; diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 455ecc2..6800177 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -743,7 +743,6 @@ function hook_field_widget_info() { 'text_textfield' => array( 'label' => t('Text field'), 'field types' => array('text'), - 'settings' => array('size' => 60), 'behaviors' => array( 'multiple values' => FIELD_BEHAVIOR_DEFAULT, 'default value' => FIELD_BEHAVIOR_DEFAULT, diff --git a/core/modules/node/node.admin.css b/core/modules/node/node.admin.css index 5777b1f..c55a298 100644 --- a/core/modules/node/node.admin.css +++ b/core/modules/node/node.admin.css @@ -1,12 +1,604 @@ - /** * @file * Styles for administration pages. */ /** + * Resets. + * + * @todo These resets should be added to Drupal's core CSS. + */ +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +legend { + display: block; + float: left; + width: 100%; + white-space: normal; + *margin-left: -7px; +} + +/** + * Remedy an issue in Chrome where shading artifacts appear on select elements + * that are animated into and out of view. + * See http://code.google.com/p/chromium/issues/detail?id=122035 + */ +select { + position: relative; +} + +/** + * Shrink-wrap the clickable region of labels to the label text. + */ +label { + display: table; +} + +/** + * Labels with explicit associations are clickable. + */ +label[for] { + cursor: pointer; +} + +/** * Revisions overview screen. */ .revision-current { background: #ffc; } + +/** + * Styles for the new node add/edit form. + */ +#page { + padding-top: 0 !important; +} + +.page-node-add.overlay #page, +.page-node-edit.overlay #page { + padding: 0 0 0 2.5% !important; +} + +.overlay { + background: #f00; +} + +.page-node-add.overlay #branding, +.page-node-edit.overlay #branding { + background: transparent; + padding: 0; +} + +.breadcrumb { + display: none; +} + +.edit-primary, +.page-node-add #console, +.page-node-edit #console, +.page-node-add #help, +.page-node-edit #help { + float: left; + width: 65.5%; +} + +.overlay .edit-primary { + margin-top: 1em; +} + +.edit-secondary { + background-color: #eee; + border: 1px solid #dfdfdf; + position: relative; + margin-left: 68%; + margin-top: 2em; + width: 32%; +} + +.overlay .edit-secondary { + margin-top: 0; + border: 0; + border-left: 1px solid hsla(0, 0%, 0%, .1); +} + +/** + * Gradients on .edit-secondary look odd because they are drawn over by the + * .collapsible borders. Fix that with pseudo-elements whose z-index we can + * control. We can't use :after because it might interfere with clearfix. + */ +.overlay .edit-secondary:before, +.overlay .node-form > div:before { + bottom: 0; + content: ""; + pointer-events: none; /* Allow clicks. */ + position: absolute; + top: 0; +} + +.overlay .edit-secondary:before { + background-image: -moz-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -ms-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .05), transparent); + left: 0; + width: .75em; + z-index: 3; +} + +#edit-revision-information { + border-bottom: 1px solid #c9c9c9; +} + +.edit-secondary .collapsible { + background-color: transparent; + border-top: 1px solid #fefefe; + border-right: 0px; + border-bottom: 1px solid #c9c9c9; + border-left: 0px; + padding: 0; +} + +.edit-secondary .expanded { + background-color: #e2e2e2; + border-top: 1px solid #b5b5b5; + border-bottom: 1px solid #b3b3b3; + margin-top: -1px; + padding: 1px 0; + -moz-transition: background-color .1s; + -ms-transition: background-color .1s; + -o-transition: background-color .1s; + -webkit-transition: background-color .1s; + transition: background-color .1s; +} + +.edit-secondary .expanded + .expanded { + border-top: 1px solid #f3f3f3; + margin-top: 0; +} + +.edit-secondary .collapsed + .expanded, +.edit-secondary #edit-revision-information + .expanded, +.edit-secondary .expanded:first-child { + -moz-box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); + -webkit-box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); + box-shadow: inset 0 2px .5em rgba(0, 0, 0, .1); +} + +.edit-secondary .collapsible .fieldset-legend { + background: none !important; /* Override system. */ + display: block; + left: 0; + margin: 0; + padding: 0 !important; /* Override system. */ + position: relative; + right: 0; +} + +/** + * Toggle anchor. + */ +.edit-secondary .collapsible .fieldset-title { + background: url(../../misc/menu-expanded.png) no-repeat 95% 50%; /* LTR */ + color: #004F80; + display: block; + font-size: 1.05em; + padding: .85em 1.25em; + text-transform: none; +} + +.overlay .edit-secondary .collapsible .fieldset-title { + background-position: 93% 50%; +} + +.overlay .edit-secondary .collapsible.collapsed .fieldset-title { + font-weight: normal; +} + +/** + * The legend is floated to force display. We need to clear it. + */ +.edit-secondary .collapsible .fieldset-wrapper { + clear: both; + padding: 0 1.25em 1.25em !important; +} + +.edit-secondary .collapsed .fieldset-title { + background-image: url(../../misc/menu-collapsed.png); + color: #0074BD; +} + +.edit-secondary .button-duplicate { + margin-left: 10px; +} + +.form-actions { + clear: both; +} + +.description { + font-family: serif; + font-style: italic; +} + +#edit-title { + width: 100%; +} + +.fieldset-legend .summary { + display: none; +} + +#edit-additional-settings { + border-top: 0; + border-right: 0px; + border-bottom: 1px solid #fdfdfd; + border-left: 0px; + margin: 0; + padding: 0; + text-shadow: 0px 1px 0px rgba(255, 255, 255, .75); +} + +fieldset .form-wrapper { + margin: 0; +} + +#edit-additional-settings, #edit-additional-settings > div.fieldset-wrapper { + padding: 0; +} + +.node-form { + color: #464646; +} + +ul.tips, div.description, .form-item div.description { + color: #464646; +} + +.page-node-add #overlay-content, +.page-node-edit #overlay-content { + padding: 0; +} + +#overlay-content #block-system-main > .content > h3, +#overlay-content #block-system-main > .content > h3 { + clear: both; +} + +.page-node-edit #help { + margin-top: 0; +} + +.node-summary { + overflow: hidden; + padding: .5em 1.25em 15px 1.25em; +} + +.page-node-add .node-summary { + border-bottom: 1px solid #d1d1d1; + padding: .5em 1.25em 1.25em 1.25em; +} + +.node-summary h3 { + margin-bottom: 0; +} + +.node-summary p { + font-size: 90%; + margin-top: 0; + padding-top: 0; +} + +.node-summary ul, +.node-summary li { + list-style: none; + margin-left: -20px; +} + +/*.node-form .node-actions { + background: -moz-linear-gradient(top, #f1f1f1, #fafafa); + background: -ms-linear-gradient(top, #f1f1f1, #fafafa); + background: -o-linear-gradient(top, #f1f1f1, #fafafa); + background: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#fafafa)); + background: -webkit-linear-gradient(top, #f1f1f1, #fafafa); + margin: 20px 0; + padding: 10px; +}*/ + +.node-save-actions { + display: inline-block; + margin: 0 10px 0 0; + padding: .3em; + border-radius: 3px; + background: #b5b5b5; +} + +.node-actions { + width: 100%; + background: #f9f9f9 -webkit-gradient(linear, left top, left bottom, #f0f0f0, #f9f9f9); + background: #f9f9f9 -webkit-linear-gradient(top, #f0f0f0, #fff); + background: #f9f9f9 -moz-linear-gradient(top, #f0f0f0, #fff); + background: #f9f9f9 -ms-linear-gradient(top, #f0f0f0, #fff); + background: #f9f9f9 -o-linear-gradient(top, #f0f0f0, #fff); + border-radius: 3px; + -moz-box-shadow: inset 0 1px 2px hsla(0, 0%, 0%, .1); + -webkit-box-shadow: inset 0 1px 2px hsla(0, 0%, 0%, .1); + box-shadow: inset 0 1px 2px hsla(0, 0%, 0%, .1); + display: inline-block; + padding: 1em 9px; + box-sizing: border-box; +} + +.node-save-actions .fieldset-wrapper { + margin: 0; + padding: 0; +} + +.node-save-actions .form-item-status { + display: inline-block; + margin: 0 5px 0 0; + padding: 0; +} + +#edit-status { + font-size: 14px; + vertical-align: middle; +} + +.node-form .node-actions input.form-submit { + background: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#e0e0e0)); + background: -moz-linear-gradient(top, #fefefe, #e0e0e0); + background: -ms-linear-gradient(top, #fefefe, #e0e0e0); + background: -o-linear-gradient(top, #fefefe, #e0e0e0); + background: -webkit-linear-gradient(top, #fefefe, #e0e0e0); + border: 1px solid #c8c8c8; + border-radius: 3px; + margin: 0 5px 0 0; + min-width: 135px; + padding: .5em; +} + +.node-form .node-actions input#edit-submit { + background: -webkit-gradient(linear, left top, left bottom, from(#4fa0ea), to(#3974ae)); + background: -webkit-linear-gradient(top, #4fa0ea, #3974ae); + background: -moz-linear-gradient(top, #4fa0ea, #3974ae); + background: -ms-linear-gradient(top, #4fa0ea, #3974ae); + background: -o-linear-gradient(top, #4fa0ea, #3974ae); + border-color: #3974ae; + color: white; + text-shadow: 0px 1px 0px rgba(0, 0, 0, .25); +} + +.node-form .node-actions input#edit-delete { + min-width: 0; + padding: 0; + margin: .7em 12px; + border: 1px solid transparent; + color: #DF2729; + background: none; + overflow: visible; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + float: right; +} + +.node-form .node-actions input#edit-delete:hover, +.node-form .node-actions input#edit-delete:focus, +.node-form .node-actions input#edit-delete:active { + color: #000; +} + + +.node-form input.form-autocomplete, +.node-form input.form-text, +.node-form input.form-tel, +.node-form input.form-email, +.node-form input.form-url, +.node-form input.form-search, +.node-form textarea.form-textarea { + border: 1px solid #c8c8c8; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #424242; + font-family: serif; + font-size: 1.2em; + padding: 8px; + max-width: 100%; +} + +.node-form input.form-autocomplete:not([size]), +.node-form input.form-text:not([size]), +.node-form input.form-tel:not([size]), +.node-form input.form-email:not([size]), +.node-form input.form-url:not([size]), +.node-form input.form-search:not([size]), +.node-form textarea.form-textarea:not([size]) { + width: 100%; +} + +.js .node-form input.form-autocomplete { + background-position: 100% 0; +} + +.js .node-form input.throbbing { + background-position: 100% 0; +} + +.node-form input.form-autocomplete:focus, +.node-form input.form-text:focus, +.node-form input.form-tel:focus, +.node-form input.form-email:focus, +.node-form input.form-url:focus, +.node-form input.form-search:focus, +.node-form textarea.form-textarea:focus, +.node-form select.form-select:focus { + border-color: #c8c8c8; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + outline: 2px solid #c8c8c8; + -moz-transition: none; + -webkit-transition: none; + transition: none; +} + +.node-form .form-item label { + margin-bottom: 5px; + font-size: 1.2em; +} + +.node-form .edit-secondary .form-item label { + font-size: 1em; +} + +.node-form .edit-secondary input.form-autocomplete, +.node-form .edit-secondary input.form-text, +.node-form .edit-secondary input.form-tel, +.node-form .edit-secondary input.form-email, +.node-form .edit-secondary input.form-url, +.node-form .edit-secondary input.form-search { + width: 100%; + padding: 5px; +} + +.node-form-revision-information { + border: 0; + background: none; + padding: 0; +} + +/** + * Special button styles + * @todo needs rafactoring, including the above + */ +#edit-actions .button, +#edit-actions input#edit-submit { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + display: inline-block; + padding: .4em 2.25em; + + /* For input.button */ + margin-bottom: 0; + margin-top: 0; + + font-size: 14px; + line-height: normal; + color: #222; + text-align: center; + text-shadow: 0 1px 1px hsla(0, 0%, 100%, .75); + vertical-align: middle; + background: #f9f9f9 -webkit-gradient(linear, left top, left bottom, from(transparent), to(hsla(0, 0%, 0%, .12))); + background: #f9f9f9 -webkit-linear-gradient(top, transparent, hsla(0, 0%, 0%, .12)); + background: #f9f9f9 -moz-linear-gradient(top, transparent, hsla(0, 0%, 0%, .12)); + background: #f9f9f9 -ms-linear-gradient(top, transparent, hsla(0, 0%, 0%, .12)); + background: #f9f9f9 -o-linear-gradient(top, transparent, hsla(0, 0%, 0%, .12)); + border: 1px solid #bbb; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .15), inset 0 1px 0 hsla(0, 0%, 100%, .35); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .15), inset 0 1px 0 hsla(0, 0%, 100%, .35); + box-shadow: 0 1px 3px rgba(0, 0, 0, .15), inset 0 1px 0 hsla(0, 0%, 100%, .35); + cursor: pointer; + + position: relative; + z-index: 10; +} + +/* Hover state */ +#edit-actions .button:hover, +#edit-actions input#edit-submit:hover { + color: #222; + text-decoration: none; + background-color: white; +} + +/* Focus state for keyboard and accessibility */ +#edit-actions .button:focus, +#edit-actions input#edit-submit { + /* @todo Custom focus styles? */ +} + +/* Active state */ +#edit-actions .button.active, +#edit-actions .button:active, +#edit-actions input#edit-submit.active, +#edit-actions input#edit-submit:active { + background-image: none; + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); + -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); + background: #efefef -webkit-linear-gradient(bottom, transparent, hsla(0, 0%, 0%, .08)); + outline: 0; +} + +/* Disabled state */ +#edit-actions .button.disabled, +#edit-actions .button[disabled], +#edit-actions input#edit-submit.disabled, +#edit-actions input#edit-submit[disabled] { + cursor: default; + background-image: none; + background-color: #eee; + opacity: .65; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/** + * Button sub-classes + */ + +/* Text color */ +#edit-actions .button-primary, +#edit-actions input#edit-submit.button-primary { + text-shadow: 0 1px 2px hsla(0, 0%, 0%, .5); + color: white; + font-weight: 500; +} + +/* Backgrounds */ +#edit-actions .button-primary, +#edit-actions input#edit-submit.button-primary { + background: #4e9ee9 -webkit-linear-gradient(top, #509fea, #4481dc); + border-color: #3974b0; +} +#edit-actions .button-primary:hover, +#edit-actions input#edit-submit.button-primary:hover { + background: #5db0ff -webkit-linear-gradient(top, #56adff, #4a8bed); +} +#edit-actions .button-primary:active, +#edit-actions input#edit-submit.button-primary:active { + background: #4481dc -webkit-linear-gradient(bottom, transparent, hsla(0, 0%, 0%, .15)); + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); + -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); +} + + +/** + * Cross-browser Jank + */ + +button.button, +input[type="submit"].button { + + /* Old FF */ + &::-moz-focus-inner { + padding: 0; + border: 0; + } +} + diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index 1bb4547..6012a78 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -493,7 +493,7 @@ function node_admin_nodes() { ), 'type' => check_plain(node_type_get_name($node)), 'author' => theme('username', array('account' => $node)), - 'status' => $node->status ? t('published') : t('not published'), + 'status' => $node->status ? t('Published') : t('Not published'), 'changed' => format_date($node->changed, 'short'), ); if ($multilingual) { diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index faa3dea..14bf24f 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -130,8 +130,15 @@ function node_form_validate($form, &$form_state) { * @ingroup forms */ function node_form($form, &$form_state, Node $node) { - global $user; - + // Wrap main form components in a div + $form['edit_primary'] = array( + '#type' => 'markup', + '#prefix' => '
', + '#suffix' => '
', + '#attached' => array( + 'css' => array(drupal_get_path('module', 'node') . '/node.admin.css'), + ), + ); // During initial form build, add the node entity to the form state for use // during form building and processing. During a rebuild, use what is in the // form state. @@ -162,6 +169,7 @@ function node_form($form, &$form_state, Node $node) { $form[$key] = array( '#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL, + '#group' => 'edit_primary', ); } @@ -169,6 +177,7 @@ function node_form($form, &$form_state, Node $node) { $form['changed'] = array( '#type' => 'hidden', '#default_value' => isset($node->changed) ? $node->changed : NULL, + '#group' => 'edit_primary', ); // 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. @@ -178,6 +187,8 @@ function node_form($form, &$form_state, Node $node) { if (function_exists($function) && ($extra = $function($node, $form_state))) { $form = array_merge_recursive($form, $extra); } + $form['edit_primary']['title'] = $form['title']; + unset($form['title']); // 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'])) { @@ -198,29 +209,40 @@ function node_form($form, &$form_state, Node $node) { '#title' => t('Language'), '#default_value' => $node->langcode, '#options' => $language_options, + '#group' => 'edit_primary', '#access' => !variable_get('node_type_language_hidden_' . $node->type, TRUE), ); } else { $form['langcode'] = array( '#type' => 'value', + // New nodes without multilingual support get the default language, old + // nodes keep their language if language.module is not available. + '#group' => 'edit_primary', '#value' => $node->langcode, ); } - $form['additional_settings'] = array( - '#type' => 'vertical_tabs', - '#weight' => 99, - ); + if (!$node->isNew()) { + $author = user_load($node->uid); + $published = (isset($node->status) && $node->status == 1) ? t('Published') : t('Not published'); + $node_summary = '

' . $published . '

'; + $node_summary .= '

' . t('Last saved') . ': ' . format_date($node->changed) . '

'; + $node_summary .= '
' . t('Author') . ': ' . user_format_name($author) . '
'; + $node_summary .= '
' . t('URL') . ': ' . drupal_get_path_alias('node/' . $node->id()) . '
'; + } + else { + $node_summary = '

' . t('Not published') . '

'; + $node_summary .= '

' . t('Not saved yet') . '

'; + $node_summary .= '' . t('Author') . ': ' . user_format_name($GLOBALS['user']) . '
'; + } // Add a log field if the "Create new revision" option is checked, or if the // current user has the ability to check that option. $form['revision_information'] = array( '#type' => 'fieldset', - '#title' => t('Revision information'), - '#collapsible' => TRUE, - // Collapsed by default when "Create new revision" is unchecked - '#collapsed' => !$node->revision, + '#collapsible' => FALSE, + '#collapsed' => FALSE, '#group' => 'additional_settings', '#attributes' => array( 'class' => array('node-form-revision-information'), @@ -228,15 +250,17 @@ function node_form($form, &$form_state, Node $node) { '#attached' => array( 'js' => array(drupal_get_path('module', 'node') . '/node.js'), ), - '#weight' => 20, - '#access' => $node->revision || user_access('administer nodes'), + '#weight' => -99, + '#access' => !$node->isNew() && ($node->revision || user_access('administer nodes')), ); + $form['revision_information']['revision'] = array( '#type' => 'checkbox', '#title' => t('Create new revision'), '#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. @@ -247,12 +271,28 @@ function node_form($form, &$form_state, Node $node) { ), ); } + $form['revision_information']['log'] = array( '#type' => 'textarea', '#title' => t('Revision log message'), '#rows' => 4, '#default_value' => !empty($node->log) ? $node->log : '', '#description' => t('Briefly describe the changes you have made.'), + '#attributes' => array( + 'name' => 'log', + ), + '#states' => array( + 'visible' => array( + ':input[name="revision"]' => array('checked' => TRUE), + ), + ), + ); + + $form['additional_settings'] = array( + '#type' => 'fieldset', + '#weight' => 99, + '#prefix' => '
' . $node_summary, + '#suffix' => '
', ); // Node author information for administrators @@ -277,19 +317,23 @@ function node_form($form, &$form_state, Node $node) { ), '#weight' => 90, ); + $form['author']['name'] = array( '#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, + '#size' => 40, '#autocomplete_path' => 'user/autocomplete', '#default_value' => !empty($node->name) ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))), ); + $form['author']['date'] = array( '#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, + '#size' => 40, '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? date_format(date_create($node->date), 'Y-m-d H:i:s O') : format_date($node->created, 'custom', 'Y-m-d H:i:s O'), '%timezone' => !empty($node->date) ? date_format(date_create($node->date), 'O') : format_date($node->created, 'custom', 'O'))), '#default_value' => !empty($node->date) ? $node->date : '', ); @@ -308,18 +352,15 @@ function node_form($form, &$form_state, Node $node) { '#attached' => array( 'js' => array(drupal_get_path('module', 'node') . '/node.js'), ), - '#weight' => 95, - ); - $form['options']['status'] = array( - '#type' => 'checkbox', - '#title' => t('Published'), - '#default_value' => $node->status, + '#weight' => -95, ); + $form['options']['promote'] = array( '#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote, ); + $form['options']['sticky'] = array( '#type' => 'checkbox', '#title' => t('Sticky at top of lists'), @@ -327,29 +368,58 @@ function node_form($form, &$form_state, Node $node) { ); // Add the buttons. - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( + $form['edit_primary']['actions'] = array('#type' => 'actions',); + $form['edit_primary']['actions']['#attributes']['class'][] = 'node-actions'; + $form['edit_primary']['actions']['save'] = array( + '#type' => 'fieldset', + '#weight' => 5, + ); + + $form['edit_primary']['actions']['save']['#attributes']['class'][] = 'node-save-actions'; + $form['edit_primary']['actions']['save']['submit'] = array( '#type' => 'submit', '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview'])), '#value' => t('Save'), '#weight' => 5, + '#attributes' => array( + 'class' => array('button', 'button-primary'), + ), '#submit' => array('node_form_submit'), ); - $form['actions']['preview'] = array( + + $form['edit_primary']['actions']['save']['status'] = array( + '#type' => 'select', + '#options' => array( + 0 => t('Not published'), + 1 => t('Published'), + ), + '#default_value' => $node->status, + '#weight' => 10, + ); + + $form['edit_primary']['actions']['preview'] = array( '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED, '#type' => 'submit', '#value' => t('Preview'), '#weight' => 10, + '#attributes' => array( + 'class' => array('button'), + ), '#submit' => array('node_form_build_preview'), ); + if (!empty($node->nid) && node_access('delete', $node)) { - $form['actions']['delete'] = array( + $form['edit_primary']['actions']['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), '#weight' => 15, + '#attributes' => array( + 'class' => array('button', 'button-delete'), + ), '#submit' => array('node_form_delete_submit'), ); } + // This form uses a button-level #submit handler for the form's main submit // action. node_form_submit() manually invokes all form-level #submit handlers // of the form. Without explicitly setting #submit, Form API would auto-detect @@ -362,7 +432,7 @@ function node_form($form, &$form_state, Node $node) { } $form += array('#submit' => array()); - field_attach_form('node', $node, $form, $form_state, $node->langcode); + field_attach_form('node', $node, $form['edit_primary'], $form_state, $node->langcode); return $form; }