diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index caa3661..ab03d41 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -107,7 +107,6 @@ function testCommentEnable() { * Tests that comment module works correctly with plain text format. */ function testCommentFormat() { - menu_router_rebuild(); // Disable text processing for comments. $this->drupalLogin($this->admin_user); $edit = array('instance[settings][text_processing]' => 0); diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index b3d58bf..d8b964b 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -195,7 +195,7 @@ function testForum() { // Test loading multiple forum nodes on the front page. $this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content', 'post comments'))); - $this->drupalPost('admin/structure/types/manage/forum', array('options[promote]' => 'promote'), t('Save content type')); + $this->drupalPost('admin/structure/types/manage/forum', array('settings[node][options][promote]' => 'promote'), t('Save content type')); $this->createForumTopic($this->forum, FALSE); $this->createForumTopic($this->forum, FALSE); $this->drupalGet('node'); diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index daea2f6..3b24fd5 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -17,6 +17,8 @@ */ class NodeFormController extends EntityFormController { + protected $settings; + /** * Prepares the node object. * @@ -27,16 +29,20 @@ class NodeFormController extends EntityFormController { */ protected function prepareEntity(EntityInterface $node) { // Set up default values, if required. - $node_options = config('node.settings.' . $node->type)->get('options'); - if (!isset($node_options)) { - $node_options = array('status', 'promote'); - } + $type = entity_load('node_type', $node->bundle()); + $this->settings = $type->getNodeSettings('node'); + $this->settings += array( + 'options' => array('status', 'promote'), + 'preview' => DRUPAL_OPTIONAL, + 'submitted' => TRUE, + ); + // If this is a new node, fill in the default values. if (!isset($node->nid) || isset($node->is_new)) { foreach (array('status', 'promote', 'sticky') as $key) { // Multistep node forms might have filled in something already. if (!isset($node->$key)) { - $node->$key = (int) in_array($key, $node_options); + $node->$key = (int) in_array($key, $this->settings['options']); } } global $user; @@ -49,7 +55,7 @@ protected function prepareEntity(EntityInterface $node) { $node->log = NULL; } // Always use the default revision setting. - $node->setNewRevision(in_array('revision', $node_options)); + $node->setNewRevision(in_array('revision', $this->settings['options'])); node_invoke($node, 'prepare'); module_invoke_all('node_prepare', $node); @@ -254,10 +260,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { protected function actions(array $form, array &$form_state) { $element = parent::actions($form, $form_state); $node = $this->getEntity($form_state); - $preview_mode = config('node.settings.' . $node->type)->get('preview'); - if (!isset($preview_mode)) { - $preview_mode = DRUPAL_OPTIONAL; - } + $preview_mode = $this->settings['preview']; $element['preview'] = array( '#access' => $preview_mode != DRUPAL_DISABLED, diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php index 2499aef..3dc4838 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php @@ -107,7 +107,7 @@ function testUnpublishedNodeCreation() { config('system.site')->set('page.front', 'test-page')->save(); // Set "Basic page" content type to be unpublished by default. - config('node.settings.page')->set('options', array())->save(); + config('node.type.page')->set('settings.node.options', array())->save(); // Create a node. $edit = array(); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php index 2a8821e..e97927c 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php @@ -34,7 +34,7 @@ function testPagePostInfo() { // Set "Basic page" content type to display post information. $edit = array(); - $edit['submitted'] = TRUE; + $edit['settings[node][submitted]'] = TRUE; $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); // Create a node. @@ -48,16 +48,11 @@ function testPagePostInfo() { $node = $this->drupalGetNodeByTitle($edit["title"]); $elements = $this->xpath('//*[contains(@class,:class)]', array(':class' => 'submitted')); $this->assertEqual(count($elements), 1, 'Post information is displayed.'); - } - - /** - * Confirms absence of post information on a new node. - */ - function testPageNotPostInfo() { + $node->delete(); // Set "Basic page" content type to display post information. $edit = array(); - $edit['submitted'] = FALSE; + $edit['settings[node][submitted]'] = FALSE; $this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type')); // Create a node. diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php index 6f0eafd..1cf2db9 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php @@ -52,13 +52,15 @@ function testPagePreview() { /** * Checks the node preview functionality, when using revisions. + * + * @todo This test passes even with revisioning disabled. */ function testPagePreviewWithRevisions() { $langcode = LANGUAGE_NOT_SPECIFIED; $title_key = "title"; $body_key = "body[$langcode][0][value]"; // Force revision on "Basic page" content. - config('node.settings.page')->set('options', array('status', 'revision')); + config('node.type.page')->set('settings.node.options', array('status', 'revision'))->save(); // Fill in node creation form and preview node. $edit = array(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php index 66fd148..cf005e8 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php @@ -66,9 +66,9 @@ function setUp() { * @see http://drupal.org/node/1708692 */ protected function mockStandardInstall() { - $type = $this->drupalCreateContentType( + $type = $this->drupalCreateContentType(array( 'type' => 'article', - ); + )); // Create the vocabulary for the tag field. $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Views testing tags',