diff --git a/core/includes/form.inc b/core/includes/form.inc index 3c88b1e915ac9a1dfaf24e39f485916d1ed9c94e..03d9529539a425e368deae5e0ec706ac4018f24f 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -2800,10 +2800,15 @@ function theme_fieldset($variables) { $element['#attributes']['aria-describedby'] = $description_id; } + $legend_attributes = array(); + if (isset($element['#title_display']) && $element['#title_display'] == 'invisible') { + $legend_attributes['class'][] = 'element-invisible'; + } + $output = ''; if (!empty($element['#title'])) { // Always wrap fieldset legends in a SPAN for CSS positioning. - $output .= '' . $element['#title'] . ''; + $output .= '' . $element['#title'] . ''; } $output .= '
'; if (!empty($element['#description'])) { diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index 0b892eb13ffe20122ab3ff611eaf1aa9947d3d57..e44290e290ad13a8b935688198adc60e1aeec985 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -108,20 +108,44 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#access' => isset($language_configuration['language_hidden']) && !$language_configuration['language_hidden'], ); - $form['additional_settings'] = array( - '#type' => 'vertical_tabs', - '#weight' => 99, + // Build variables for use in the node settings summary. + $publish_state = ''; + $last_saved = ''; + $author = ''; + if (!$node->isNew()) { + $publish_state = (isset($node->status) && $node->status == 1) ? t('Published') : t('Not published'); + $last_saved = '' . t('Last saved') . ': ' .format_date($node->changed); + $author = '' . t('Author') . ': ' . user_format_name(user_load($node->uid)); + } + else { + $publish_state = t('Not published'); + $last_saved = t('Not saved yet'); + } + // Create the node settings summary that appears (by default) at the top + // of the settings region. Always contains publish state, date/time last + // saved, and author. + $form['settings_summary'] = array ( + '#type' => 'fieldset', + 'publish_state' => array( + '#type' => 'item', + '#markup' => $publish_state, + ), + 'last_saved' => array( + '#type' => 'item', + '#markup' => $last_saved, + ), + 'author' => array( + '#type' => 'item', + '#markup' => $author, + ), ); // 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' => 'details', + $form['settings_summary']['revision_information'] = array( + '#type' => 'fieldset', '#title' => t('Revision information'), - '#collapsible' => TRUE, - // Collapsed by default when "Create new revision" is unchecked. - '#collapsed' => !$node->isNewRevision(), - '#group' => 'additional_settings', + '#title_display' => 'invisible', '#attributes' => array( 'class' => array('node-form-revision-information'), ), @@ -132,30 +156,35 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#access' => $node->isNewRevision() || user_access('administer nodes'), ); - $form['revision_information']['revision'] = array( + $new_revision_control_default_value = false; + if (!$node->isNew()) { + $new_revision_control_default_value = $node->isNewRevision(); + } + + $form['settings_summary']['revision_information']['revision'] = array( '#type' => 'checkbox', '#title' => t('Create new revision'), - '#default_value' => $node->isNewRevision(), + '#default_value' => $new_revision_control_default_value, '#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. - if (!$node->isNewRevision()) { - $form['revision_information']['revision']['#states'] = array( - 'checked' => array( - 'textarea[name="log"]' => array('empty' => FALSE), - ), - ); - } - - $form['revision_information']['log'] = array( + $form['settings_summary']['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' => 'details', + '#weight' => 99, ); // Node author information for administrators. diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index d74f50278b9d0b2f148553df887a69f3c6983805..f1925cbabeea380e6acfabe199ac9f51f245ce64 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -503,8 +503,7 @@ details { line-height: 1.295em; } details summary { - padding-top: 0.5em; - padding-bottom: 0.5em; + padding: 12px 16px; } details details { background-color: #fff; @@ -1401,3 +1400,117 @@ details.fieldset-no-legend { /* @end */ /* @end */ + +/** + * Node add/edit screen + */ +[id="edit-settings-summary"] { + background-color: #f2f2f2; + border: 1px solid #a5a5a5; + margin-bottom: 0; + overflow: hidden; + padding: 0; +} +[id="edit-settings-summary"] > .fieldset-wrapper { + padding: 16px; +} +[id="edit-settings-summary"] .label { + font-weight: bold; +} +[id="edit-settings-summary"] .form-item { + font-size: 1em; + margin: 0; + padding: 0; +} +[id="edit-settings-summary"] .form-item-log { + margin-top: .5em; +} +#edit-publish-state { + font-size: 1.231em; + font-weight: bold; + margin-bottom: 0; + margin-top: .25em; + text-shadow: 0 1px 0 white; +} +#edit-last-saved { + font-style: italic; + margin-bottom: .5em; +} +#edit-last-saved .label { + font-weight: normal; +} +.node-form-revision-information { + padding: 0; + background: transparent; + margin-bottom: .5em; + border: 0; +} +.node-form-revision-information > .details-wrapper { + padding: 0; +} + +[id="edit-additional-settings"] { + background-color: #e2e2e2; + border-bottom: 0; + border-left: 1px solid #a5a5a5; + border-right: 1px solid #a5a5a5; + border-top: 0; + -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, .15); + box-shadow: inset 0 0 5px rgba(0, 0, 0, .15); + margin-top: 0; + padding-top: 0; +} +[id="edit-additional-settings"] > .details-wrapper { + padding: 0; +} +/* Details elements; default styling is for the open state */ +[id="edit-additional-settings"] details { + background-color: transparent; + border-bottom: 1px solid #959595; + border-left: 0; + border-right: 0; + border-top: 1px solid white; + padding-top: 0; + margin: 0; +} +[id="edit-additional-settings"] details > summary { + text-shadow: 0 1px 0 white; + padding: 11px 16px 12px 16px; +} +[id="edit-additional-settings"] details > .details-wrapper { + padding-top: 0; +} +/* JS-driven summary */ +[id="edit-additional-settings"] details .summary { + display: none; +} +/** + * Add a top inset shadow to all open details elements that don't follow another + * open details element. + */ +[id="edit-additional-settings"] details:first-child, +[id="edit-additional-settings"] .collapsed + details, +[id="edit-additional-settings"] details:not([open]) + details { + background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, .15), transparent 5px); + background-image: -moz-linear-gradient(top, rgba(0, 0, 0, .15), transparent 5px); + background-image: -o-linear-gradient(top, rgba(0, 0, 0, .15), transparent 5px); + background-image: linear-gradient(to bottom, rgba(0, 0, 0, .15), transparent 5px); + border-top: 0 none; + padding-top: 1px; +} +/* Force closed details elements to appear closed. */ +[id="edit-additional-settings"] .collapsed, +[id="edit-additional-settings"] details:not([open]) { + background-color: #f2f2f2 !important; + background-image: none !important; + border-bottom: 1px solid #a5a5a5 !important; + border-top: 1px solid white !important; + padding-top: 0 !important; +} +[id="edit-additional-settings"] details a { + color: #005e99; +} +[id="edit-additional-settings"] .collapsed a, +[id="edit-additional-settings"] details:not([open]) a { + color: #0074bd; +}