diff --git a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php index edb1532..1c31b3f 100644 --- a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityFormController; use Drupal\Component\Utility\MapArray; -use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Component\Utility\String; /** diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php b/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php index 533c87b..dcb0518 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTestBase.php @@ -35,7 +35,7 @@ function setUp() { // Create Basic page and Article node types. if ($this->profile != 'standard') { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page', 'settings' => array( - // Set proper default options for page content type. + // Set proper default options for the page content type. 'node' => array( 'options' => array('promote' => FALSE), 'submitted' => FALSE, diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 158b69b..ab20a51 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -692,9 +692,11 @@ function template_preprocess_node(&$variables) { field_attach_preprocess($node, $variables['content'], $variables); // Display post information only on certain node types. - // Avoid loading the entire node type config entity here. - if (\Drupal::config('node.type.' . $node->bundle())->get('settings.node.submitted')) { - $variables['display_submitted'] = TRUE; + // Avoid loading the entire node type config entity here that may not exist. + $node_type_config = \Drupal::config('node.type.nd'); + // Display submitted by default. + $variables['display_submitted'] = $node_type_config->isNew() || $node_type_config->get('settings.node.submitted'); + if ($variables['display_submitted']) { $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date'])); if (theme_get_setting('features.node_user_picture')) { // To change user picture settings (e.g. image style), edit the 'compact' @@ -707,7 +709,6 @@ function template_preprocess_node(&$variables) { } } else { - $variables['display_submitted'] = FALSE; $variables['submitted'] = ''; $variables['user_picture'] = ''; } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php index 1839510..073490d 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php @@ -78,7 +78,6 @@ function testUserAttributesInMarkup() { // User 2 creates a node. $this->drupalLogin($user2); - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); $this->drupalLogin($user1); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 222098b..7541fb2 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -289,7 +289,9 @@ protected function drupalCreateNode(array $settings = array()) { ); $node = entity_create('node', $settings); - $node->setNewRevision(!empty($settings['revision'])); + if (!empty($settings['revision'])) { + $node->setNewRevision(); + } $node->save(); return $node; diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php index d40e680..f00b5ba 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php @@ -36,7 +36,6 @@ function setUp() { // Create admin user and log in admin user. $this->admin_user = $this->drupalCreateUser(array('administer site configuration')); $this->drupalLogin($this->admin_user); - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); } /** diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php index 9fe4403..956a257 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php @@ -44,7 +44,6 @@ function testUserTimeZone() { $date2 = '2007-03-11 01:00:00 -0800'; // One date in PDT (summer time): $date3 = '2007-03-20 21:00:00 -0700'; - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); $node1 = $this->drupalCreateNode(array('created' => strtotime($date1), 'type' => 'article')); $node2 = $this->drupalCreateNode(array('created' => strtotime($date2), 'type' => 'article')); $node3 = $this->drupalCreateNode(array('created' => strtotime($date3), 'type' => 'article'));