diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 99edfc5..af436d4 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -425,7 +425,7 @@ function _book_add_form_elements(&$form, &$form_state, Node $node) { '#weight' => 10, '#collapsible' => TRUE, '#collapsed' => TRUE, - '#group' => 'additional_settings', + '#group' => 'advanced', '#attributes' => array( 'class' => array('book-outline-form'), ), diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 9cb4ebf..faffe00 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1115,7 +1115,7 @@ function comment_form_node_form_alter(&$form, $form_state) { '#title' => t('Comment settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, - '#group' => 'additional_settings', + '#group' => 'advanced', '#attributes' => array( 'class' => array('comment-node-settings-form'), ), diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 3d4a360..74be6e2 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -579,7 +579,7 @@ function menu_form_node_form_alter(&$form, $form_state) { '#access' => user_access('administer menu'), '#collapsible' => TRUE, '#collapsed' => !$link['link_title'], - '#group' => 'additional_settings', + '#group' => 'advanced', '#attached' => array( 'library' => array(array('menu', 'drupal.menu')), ), diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index d2eff1d..ecbc0c7 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -56,6 +56,20 @@ protected function prepareEntity(EntityInterface $node) { * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $node) { + + // Visual representation of the node content form depends on following + // parameters: + // - the current user has access to view the administration theme. + // - the current path is an admin path. + // - the node/add / edit pages are configured to be represented in the + // administration theme. + $type = 'vertical_tabs'; + $request = drupal_container()->get('request'); + $path = $request->attributes->get('system_path'); + if (user_access('view the administration theme') && path_is_admin($path)) { + $type = 'container'; + } + $user_config = config('user.settings'); // Some special stuff when previewing a node. if (isset($form_state['node_preview'])) { @@ -109,43 +123,45 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#access' => isset($language_configuration['language_hidden']) && !$language_configuration['language_hidden'], ); - // @todo Change #type to 'container'. - // @todo Rename key to 'advanced'. - $form['additional_settings'] = array( - '#type' => 'details', + $form['advanced'] = array( + '#type' => $type, '#attributes' => array('class' => array('entity-meta')), '#weight' => 99, ); - $form['additional_settings']['meta'] = array ( + $form['meta'] = array ( '#type' => 'fieldset', '#attributes' => array('class' => array('entity-meta-header')), '#type' => 'container', + '#group' => 'advanced', '#weight' => -100, // @todo Geez. Any .status is styled as OK icon? Really? 'published' => array( '#type' => 'item', '#wrapper_attributes' => array('class' => array('published')), '#markup' => !empty($node->status) ? t('Published') : t('Not published'), - '#access' => !empty($node->nid), + '#access' => !empty($node->nid) && $type == 'container', ), 'changed' => array( '#type' => 'item', '#wrapper_attributes' => array('class' => array('changed', 'container-inline')), '#title' => t('Last saved'), '#markup' => !$node->isNew() ? format_date($node->changed, 'short') : t('Not saved yet'), + '#access' => $type == 'container', ), 'author' => array( '#type' => 'item', '#wrapper_attributes' => array('class' => array('author', 'container-inline')), '#title' => t('Author'), '#markup' => user_format_name(user_load($node->uid)), + '#access' => $type == 'container', ), ); // 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['additional_settings']['meta']['revision_information'] = array( - '#type' => 'container', + $form['revision_information'] = array( + '#type' => $type == 'container' ? 'container' : 'details', + '#group' => $type == 'container' ? 'meta' : 'advanced', '#title' => t('Revision information'), '#attributes' => array( 'class' => array('node-form-revision-information'), @@ -157,14 +173,14 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#access' => $node->isNewRevision() || user_access('administer nodes'), ); - $form['additional_settings']['meta']['revision']['revision'] = array( + $form['revision_information']['revision']['revision'] = array( '#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $node->isNewRevision(), '#access' => user_access('administer nodes'), ); - $form['additional_settings']['meta']['revision']['log'] = array( + $form['revision_information']['revision']['log'] = array( '#type' => 'textarea', '#title' => t('Revision log message'), '#rows' => 4, @@ -184,7 +200,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, - '#group' => 'additional_settings', + '#group' => 'advanced', '#attributes' => array( 'class' => array('node-form-author'), ), @@ -225,7 +241,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, - '#group' => 'additional_settings', + '#group' => 'advanced', '#attributes' => array( 'class' => array('node-form-options'), ), diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index 216cfc9..ac2bc92 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -234,4 +234,12 @@ public function createDuplicate() { public function getRevisionId() { return $this->vid; } + + /** + * Overrides Drupal\Core\Entity\Entity::isNewRevision(). + */ + public function isNewRevision() { + $options = variable_get('node_options_' . $this->bundle(), array()); + return in_array('revision', $options); + } } diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 63e5c6c..7521dee 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -124,7 +124,7 @@ function path_form_node_form_alter(&$form, $form_state) { '#title' => t('URL path settings'), '#collapsible' => TRUE, '#collapsed' => empty($path['alias']), - '#group' => 'additional_settings', + '#group' => 'advanced', '#attributes' => array( 'class' => array('path-form'), ), diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index b6871d7..445730f 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -1415,13 +1415,10 @@ details.fieldset-no-legend { margin-top: 0; padding-top: 0; } -/* @todo remove once .entity-meta is no longer a details element. */ -.entity-meta > .details-wrapper { - padding: 0; -} .entity-meta-header, .entity-meta details { background-color: #f2f2f2; + border-top: 1px solid #a5a5a5; border-bottom: 1px solid #a5a5a5; } .entity-meta-header {