diff --git a/core/modules/forum/config/install/node.type.forum.yml b/core/modules/forum/config/install/node.type.forum.yml index 00d7e5a..f7833f7 100644 --- a/core/modules/forum/config/install/node.type.forum.yml +++ b/core/modules/forum/config/install/node.type.forum.yml @@ -3,7 +3,7 @@ name: 'Forum topic' description: 'A forum topic starts a new discussion thread within a forum.' help: '' new_revision: false -show_submitted: true +display_submitted: true preview_mode: 1 status: true langcode: en diff --git a/core/modules/menu_ui/menu_ui.install b/core/modules/menu_ui/menu_ui.install index 0e580b4..a75a02c 100644 --- a/core/modules/menu_ui/menu_ui.install +++ b/core/modules/menu_ui/menu_ui.install @@ -5,8 +5,6 @@ * Install, update and uninstall functions for the menu_ui module. */ -use Drupal\Component\Uuid\Uuid; - /** * Implements hook_install(). */ @@ -17,15 +15,6 @@ function menu_ui_install() { // \Drupal\Core\Extension\ModuleHandler::install(). // @see https://drupal.org/node/2181151 \Drupal::service('router.builder')->rebuild(); - if (\Drupal::moduleHandler()->moduleExists('node')) { - $node_types = array_keys(node_type_get_names()); - foreach ($node_types as $type_id) { - \Drupal::config('menu.entity.node.' . $type_id) - ->set('available_menus', array('main')) - ->set('parent', 'main:0') - ->save(); - } - } } /** diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml index e24c22e..a1c5f3c 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml @@ -15,7 +15,7 @@ process: help: help title_label: title_label 'preview_mode': 'constants/preview' - 'display_submitted': submitted + 'display_submitted': display_submitted 'new_revision': 'options/revision' 'settings/node/options': options create_body: has_body diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php index 665cc13..3b2e443 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php @@ -110,7 +110,7 @@ public function prepareRow(Row $row) { } $row->setSourceProperty('options', $options); $submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE; - $row->setSourceProperty('submitted', $submitted); + $row->setSourceProperty('display_submitted', $submitted); return parent::prepareRow($row); } diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php index 4ec8f0e..cd396aa 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php @@ -52,16 +52,9 @@ public function testNodeType() { // Test the test_page content type. $node_type_page = entity_load('node_type', 'test_page'); $this->assertEqual($node_type_page->id(), 'test_page', 'Node type test_page loaded'); - $expected = array( - 'options' => array( - 'revision' => FALSE, - ), - 'preview' => 1, - 'submitted' => TRUE, - ); - - // @todo: Fix due to https://www.drupal.org/node/2283977 - // $this->assertEqual($node_type_page->settings['node'], $expected, 'Node type test_page settings correct.'); + $this->assertEqual($node_type_page->displaySubmitted(), TRUE); + $this->assertEqual($node_type_page->isNewRevision(), FALSE); + $this->assertEqual($node_type_page->getPreviewMode(), DRUPAL_OPTIONAL); $this->assertEqual(array('test_page'), $migration->getIdMap()->lookupDestinationID(array('test_page'))); // Test we have a body field. @@ -71,15 +64,9 @@ public function testNodeType() { // Test the test_story content type. $node_type_story = entity_load('node_type', 'test_story'); $this->assertEqual($node_type_story->id(), 'test_story', 'Node type test_story loaded'); - $expected = array( - 'options' => array( - 'revision' => FALSE, - ), - 'preview' => 1, - 'submitted' => TRUE, - ); - // @todo: Fix due to https://www.drupal.org/node/2283977 - // $this->assertEqual($node_type_story->settings['node'], $expected, 'Node type test_story settings correct.'); + $this->assertEqual($node_type_story->displaySubmitted(), TRUE); + $this->assertEqual($node_type_story->isNewRevision(), FALSE); + $this->assertEqual($node_type_story->getPreviewMode(), DRUPAL_OPTIONAL); $this->assertEqual(array('test_story'), $migration->getIdMap()->lookupDestinationID(array('test_story'))); // Test we don't have a body field. @@ -89,16 +76,9 @@ public function testNodeType() { // Test the test_event content type. $node_type_event = entity_load('node_type', 'test_event'); $this->assertEqual($node_type_event->id(), 'test_event', 'Node type test_event loaded'); - $expected = array( - 'options' => array( - 'revision' => TRUE, - ), - 'preview' => 1, - 'submitted' => TRUE, - ); - - // @todo: Fix due to https://www.drupal.org/node/2283977 - // $this->assertEqual($node_type_event->settings['node'], $expected, 'Node type test_event settings correct.'); + $this->assertEqual($node_type_event->displaySubmitted(), TRUE); + $this->assertEqual($node_type_event->isNewRevision(), TRUE); + $this->assertEqual($node_type_event->getPreviewMode(), DRUPAL_OPTIONAL); $this->assertEqual(array('test_event'), $migration->getIdMap()->lookupDestinationID(array('test_event'))); // Test we have a body field. diff --git a/core/modules/node/node.module b/core/modules/node/node.module index d96052d..62894ef 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -635,11 +635,10 @@ function template_preprocess_node(&$variables) { // Display post information only on certain node types. // Avoid loading the entire node type config entity here that may not exist. - $node_type_config = \Drupal::config('node.type.' . $node->bundle()); + $node_type = $node->type->entity; // Used by RDF to add attributes around the author and date submitted. $variables['author_attributes'] = new Attribute(); - // Display submitted by default. - $variables['display_submitted'] = $node_type_config->isNew() || $node_type_config->get('settings.node.submitted'); + $variables['display_submitted'] = $node_type->displaySubmitted(); if ($variables['display_submitted']) { if (theme_get_setting('features.node_user_picture')) { // To change user picture settings (e.g. image style), edit the 'compact' diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index 827e7f8..8694501 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -117,10 +117,9 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => $fields['title']->getLabel(), '#required' => TRUE, ); - $form['submission']['preview'] = array( + $form['submission']['preview_mode'] = array( '#type' => 'radios', '#title' => t('Preview before submitting'), - '#parents' => array('settings', 'node', 'preview'), '#default_value' => $type->getPreviewMode(), '#options' => array( DRUPAL_DISABLED => t('Disabled'), @@ -181,10 +180,9 @@ public function form(array $form, FormStateInterface $form_state) { '#title' => t('Display settings'), '#group' => 'additional_settings', ); - $form['display']['submitted'] = array( + $form['display']['display_submitted'] = array( '#type' => 'checkbox', '#title' => t('Display author and date information.'), - '#parents' => array('settings', 'node', 'submitted'), '#default_value' => $type->displaySubmitted(), '#description' => t('Author username and publish date will be displayed.'), ); diff --git a/core/modules/node/src/Tests/NodePostSettingsTest.php b/core/modules/node/src/Tests/NodePostSettingsTest.php index 35c3125..0acee50 100644 --- a/core/modules/node/src/Tests/NodePostSettingsTest.php +++ b/core/modules/node/src/Tests/NodePostSettingsTest.php @@ -29,7 +29,7 @@ function testPagePostInfo() { // Set "Basic page" content type to display post information. $edit = array(); - $edit['settings[node][submitted]'] = TRUE; + $edit['display_submitted'] = TRUE; $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); // Create a node. @@ -46,7 +46,7 @@ function testPagePostInfo() { // Set "Basic page" content type to display post information. $edit = array(); - $edit['settings[node][submitted]'] = FALSE; + $edit['display_submitted'] = FALSE; $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); // Create a node. diff --git a/core/modules/node/tests/modules/node_test_config/config/install/node.type.default.yml b/core/modules/node/tests/modules/node_test_config/config/install/node.type.default.yml index e25f414..33d62b3 100644 --- a/core/modules/node/tests/modules/node_test_config/config/install/node.type.default.yml +++ b/core/modules/node/tests/modules/node_test_config/config/install/node.type.default.yml @@ -3,7 +3,7 @@ name: Default description: 'Default description.' help: '' new_revision: false -show_submitted: true +display_submitted: true preview_mode: 1 status: true langcode: en diff --git a/core/modules/node/tests/modules/node_test_config/staging/node.type.import.yml b/core/modules/node/tests/modules/node_test_config/staging/node.type.import.yml index 8050a4e..f1bafe4 100644 --- a/core/modules/node/tests/modules/node_test_config/staging/node.type.import.yml +++ b/core/modules/node/tests/modules/node_test_config/staging/node.type.import.yml @@ -3,7 +3,7 @@ name: Import description: 'Import description.' help: '' new_revision: false -show_submitted: true +display_submitted: true preview_mode: 1 status: true langcode: en diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php index 1f39842..6a084f6 100644 --- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php +++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php @@ -242,7 +242,7 @@ public function testUserWithPermission() { // in TempStore) and then save the entity. Now there should be two // revisions. $node_type = entity_load('node_type', 'article'); - $node_type->settings['node']['options']['revision'] = TRUE; + $node_type->setNewRevision(TRUE); $node_type->save(); // Retrieve field form. diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php index 2b297a4..d097a5e 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -273,7 +273,7 @@ protected function doPageRdfaTests() { // true for testing. // @todo Clean-up standard profile defaults. $node_type = entity_load('node_type', 'page'); - $node_type->settings['node']['submitted'] = TRUE; + $node_type->setDisplaySubmitted(TRUE); $node_type->save(); // Feed the HTML into the parser. diff --git a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php index 6580e57..ea55662 100644 --- a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; +use Drupal\node\Entity\NodeType; /** * Tests breadcrumbs functionality. @@ -158,10 +159,10 @@ function testBreadCrumbs() { // breadcrumbs may differ, possibly due to theme overrides. $menus = array('main', 'tools'); // Alter node type menu settings. - \Drupal::config("menu.entity.node.$type") - ->set('available_menus', $menus) - ->set('parent', 'tools:') - ->save(); + $node_type = NodeType::load($type); + $node_type->setThirdPartySetting('menu_ui', 'available_menus', $menus); + $node_type->setThirdPartySetting('menu_ui', 'parent', 'tools:'); + $node_type->save(); foreach ($menus as $menu) { // Create a parent node in the current menu. diff --git a/core/profiles/standard/config/install/node.type.article.yml b/core/profiles/standard/config/install/node.type.article.yml index 271bf61..7cb127d 100644 --- a/core/profiles/standard/config/install/node.type.article.yml +++ b/core/profiles/standard/config/install/node.type.article.yml @@ -4,6 +4,6 @@ description: 'Use articles for time-sensitive content like news, press help: '' new_revision: false preview_mode: 1 -show_submitted: true +display_submitted: true status: true langcode: en