diff --git a/core/modules/book/config/install/node.type.book.yml b/core/modules/book/config/install/node.type.book.yml index e61498fdcf6b46786f3f20104a92070068106a33..172eaaf3008d069d0fdbde49e77127057ee3e90b 100644 --- a/core/modules/book/config/install/node.type.book.yml +++ b/core/modules/book/config/install/node.type.book.yml @@ -2,11 +2,8 @@ type: book name: 'Book page' description: '<em>Books</em> have a built-in hierarchical navigation. Use for handbooks or tutorials.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: true +new_revision: false +display_submitted: true +preview_mode: 1 status: true langcode: en diff --git a/core/modules/forum/config/install/node.type.forum.yml b/core/modules/forum/config/install/node.type.forum.yml index df4ce2e6f70a4d0c84072d29805f672631e2ede3..f7833f7300d280c7c15ec5ed6dc8614d0547e192 100644 --- a/core/modules/forum/config/install/node.type.forum.yml +++ b/core/modules/forum/config/install/node.type.forum.yml @@ -2,11 +2,8 @@ type: forum name: 'Forum topic' description: 'A <em>forum topic</em> starts a new discussion thread within a forum.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: true +new_revision: false +display_submitted: true +preview_mode: 1 status: true langcode: en diff --git a/core/modules/menu_ui/config/schema/menu_ui.schema.yml b/core/modules/menu_ui/config/schema/menu_ui.schema.yml index 7625f0d96628298999e14f2baa30c50d0d0c9578..7855ba307c21d3d4209b0152ab9d0b93e5e03255 100644 --- a/core/modules/menu_ui/config/schema/menu_ui.schema.yml +++ b/core/modules/menu_ui/config/schema/menu_ui.schema.yml @@ -14,7 +14,7 @@ menu_ui.settings: type: boolean label: 'Override parent selector' -menu.entity.node.*: +node_type.third_party.menu_ui: type: mapping label: 'Per-content type menu settings' mapping: diff --git a/core/modules/menu_ui/menu_ui.install b/core/modules/menu_ui/menu_ui.install index 0e580b446638289f97d68b009a4d668bc67531c5..a75a02ca6daab5794e059885c0da0582a7279f4b 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/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index f2591ddb053d44119a870e6a70c4766495a6efd1..69c23e375485af8c10ab7b157b73f3dd4e8187c5 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -165,29 +165,6 @@ function menu_ui_node_update(EntityInterface $node) { menu_ui_node_save($node); } -/** - * Implements hook_ENTITY_TYPE_insert() for node_type entities. - */ -function menu_ui_node_type_insert(NodeTypeInterface $type) { - if ($type->isSyncing()) { - return; - } - \Drupal::config('menu.entity.node.' . $type->id()) - ->set('available_menus', array('main')) - ->set('parent', 'main:') - ->save(); -} - -/** - * Implements hook_ENTITY_TYPE_delete() for node_type entities. - */ -function menu_ui_node_type_delete(NodeTypeInterface $type) { - if ($type->isSyncing()) { - return; - } - \Drupal::config('menu.entity.node.' . $type->id())->delete(); -} - /** * Helper for hook_ENTITY_TYPE_insert() and hook_ENTITY_TYPE_update() for nodes. */ @@ -251,13 +228,14 @@ function menu_ui_node_predelete(EntityInterface $node) { function menu_ui_node_prepare_form(NodeInterface $node, $operation, FormStateInterface $form_state) { if (empty($form_state['menu_link_definition'])) { // Prepare the node for the edit form so that $node->menu always exists. - $node_type_config = \Drupal::config('menu.entity.node.' . $node->getType()); - $menu_name = strtok($node_type_config->get('parent'), ':'); + /** @var \Drupal\node\NodeTypeInterface $node_type */ + $node_type = $node->type->entity; + $menu_name = strtok($node_type->getThirdPartySetting('menu_ui', 'parent', 'main:'), ':'); $definition = FALSE; if ($node->id()) { $id = FALSE; // Give priority to the default menu - $type_menus = $node_type_config->get('available_menus'); + $type_menus = $node_type->getThirdPartySetting('menu_ui', 'available_menus', array('main')); if (in_array($menu_name, $type_menus)) { $query = \Drupal::entityQuery('menu_link_content') ->condition('route_name', 'entity.node.canonical') @@ -323,11 +301,12 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) { // @todo This must be handled in a #process handler. $node = $form_state->getFormObject()->getEntity(); $definition = $form_state['menu_link_definition']; - $type = $node->getType(); + /** @var \Drupal\node\NodeTypeInterface $node_type */ + $node_type = $node->type->entity; /** @var \Drupal\Core\Menu\MenuParentFormSelectorInterface $menu_parent_selector */ $menu_parent_selector = \Drupal::service('menu.parent_form_selector'); $menu_names = menu_ui_get_menus(); - $type_menus = \Drupal::config("menu.entity.node.$type")->get('available_menus'); + $type_menus = $node_type->getThirdPartySetting('menu_ui', 'available_menus', array('main')); $available_menus = array(); foreach ($type_menus as $menu) { $available_menus[$menu] = $menu_names[$menu]; @@ -336,7 +315,7 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) { $default = $definition['menu_name'] . ':' . $definition['parent']; } else { - $default = \Drupal::config('menu.entity.node.'.$type)->get('parent'); + $default = $node_type->getThirdPartySetting('menu_ui', 'parent', 'main:'); } $parent_element = $menu_parent_selector->parentSelectElement($default, $definition['id'], $available_menus); // If no possible parent menu items were found, there is nothing to display. @@ -446,16 +425,8 @@ function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_stat /** @var \Drupal\Core\Menu\MenuParentFormSelectorInterface $menu_parent_selector */ $menu_parent_selector = \Drupal::service('menu.parent_form_selector'); $menu_options = menu_ui_get_menus(); + /** @var \Drupal\node\NodeTypeInterface $type */ $type = $form_state->getFormObject()->getEntity(); - if ($type->id()) { - $config_values = \Drupal::config('menu.entity.node.' . $type->id())->get(); - } - else { - $config_values = array( - 'available_menus' => array('main'), - 'parent' => 'main:', - ); - } $form['menu'] = array( '#type' => 'details', '#title' => t('Menu settings'), @@ -467,7 +438,7 @@ function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_stat $form['menu']['menu_options'] = array( '#type' => 'checkboxes', '#title' => t('Available menus'), - '#default_value' => $config_values['available_menus'], + '#default_value' => $type->getThirdPartySetting('menu_ui', 'available_menus', array('main')), '#options' => $menu_options, '#description' => t('The menus available to place links in for this content type.'), ); @@ -480,14 +451,14 @@ function menu_ui_form_node_type_form_alter(&$form, FormStateInterface $form_stat $form['menu']['menu_parent'] = array( '#type' => 'select', '#title' => t('Default parent item'), - '#default_value' => $config_values['parent'], + '#default_value' => $type->getThirdPartySetting('menu_ui', 'parent', 'main:'), '#options' => $options, '#description' => t('Choose the menu item to be the default parent for a new link in the content authoring form.'), '#attributes' => array('class' => array('menu-title-select')), ); $form['actions']['submit']['#validate'][] = 'menu_ui_form_node_type_form_validate'; - $form['actions']['submit']['#submit'][] = 'menu_ui_form_node_type_form_submit'; + $form['#entity_builders'][] = 'menu_ui_form_node_type_form_builder'; } /** @@ -511,16 +482,13 @@ function menu_ui_form_node_type_form_validate(&$form, FormStateInterface $form_s } /** - * Submit handler for forms with menu options. + * Entity builder for the node type form with menu options. * * @see menu_ui_form_node_type_form_alter(). */ -function menu_ui_form_node_type_form_submit(&$form, FormStateInterface $form_state) { - $type = $form_state->getFormObject()->getEntity(); - \Drupal::config('menu.entity.node.' . $type->id()) - ->set('available_menus', array_values(array_filter($form_state->getValue('menu_options')))) - ->set('parent', $form_state->getValue('menu_parent')) - ->save(); +function menu_ui_form_node_type_form_builder($entity_type, NodeTypeInterface $type, &$form, FormStateInterface $form_state) { + $type->setThirdPartySetting('menu_ui', 'available_menus', array_values(array_filter($form_state->getValue('menu_options')))); + $type->setThirdPartySetting('menu_ui', 'parent', $form_state->getValue('menu_parent')); } /** 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 609f391f3a386650bc7d5719f7205026ac100505..a1c5f3cc6ad24140b13c6de5ed2127f83d836ba4 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 @@ -14,8 +14,9 @@ process: description: description help: help title_label: title_label - 'settings/node/preview': 'constants/preview' - 'settings/node/submitted': submitted + 'preview_mode': 'constants/preview' + 'display_submitted': display_submitted + 'new_revision': 'options/revision' 'settings/node/options': options create_body: has_body create_body_label: body_label 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 665cc1398f5f41ebf6cc1a6dbaae8a4e6601db46..3b2e44373020bd72ff31972e58e063df560cf9d0 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 4ec8f0e370fe7b10341f6ac09c1de06632c80717..cd396aaca92b15f7a3f0b32cb0a0cf62d607da3b 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/config/schema/node.schema.yml b/core/modules/node/config/schema/node.schema.yml index 428ffc787adf978589ef21f719cb53cd00b0babe..0680b5706b89a81b313c5ed986c59f273c6ca889 100644 --- a/core/modules/node/config/schema/node.schema.yml +++ b/core/modules/node/config/schema/node.schema.yml @@ -27,39 +27,20 @@ node.type.*: help: type: text label: 'Explanation or submission guidelines' - settings: - type: mapping - label: 'Settings' - mapping: - node: - type: node.settings.node - -node.settings.node: - type: mapping - label: 'Content type settings' - mapping: - preview: + new_revision: + type: boolean + label: 'Whether a new revision should be created by default' + preview_mode: type: integer label: 'Preview before submitting' - options: - type: mapping - label: 'Publishing options' - mapping: - status: - type: boolean - label: 'Published' - promote: - type: boolean - label: 'Promoted to front page' - sticky: - type: boolean - label: 'Sticky at top of lists' - revision: - type: boolean - label: 'Create new revision' - submitted: + display_submitted: type: boolean label: 'Display setting for author and date Submitted by post information' + third_party_settings: + type: sequence + label: 'Third party settings' + sequence: + - type: node_type.third_party.[%key] # Plugin \Drupal\node\Plugin\Search\NodeSearch search.plugin.node_search: diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 55cc9ce3aa9d9e63f174abbead8e54b3beafeae7..da392615a65a0e597edc7a6adaa4035e5ecb97b2 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -635,12 +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/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php index 22f66d4814e9b4ca81a31410c80177b34e12df1b..73e120258a031a6b79e76fc47e4966b5e04d52a3 100644 --- a/core/modules/node/src/Entity/NodeType.php +++ b/core/modules/node/src/Entity/NodeType.php @@ -7,8 +7,8 @@ namespace Drupal\node\Entity; -use Drupal\Component\Utility\NestedArray; use Drupal\Core\Config\Entity\ConfigEntityBundleBase; +use Drupal\Core\Config\Entity\ThirdPartySettingsTrait; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\node\NodeTypeInterface; @@ -41,6 +41,7 @@ * ) */ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface { + use ThirdPartySettingsTrait; /** * The machine name of this node type. @@ -74,6 +75,27 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface { */ public $help; + /** + * Default value of the 'Create new revision' checkbox of this node type. + * + * @var bool + */ + protected $new_revision = FALSE; + + /** + * The preview mode. + * + * @var int + */ + protected $preview_mode = DRUPAL_OPTIONAL; + + /** + * Display setting for author and date Submitted by post information. + * + * @var bool + */ + protected $display_submitted = TRUE; + /** * Indicates whether a Body field should be created for this node type. * @@ -97,37 +119,60 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface { protected $create_body_label = 'Body'; /** - * Module-specific settings for this node type, keyed by module name. - * - * @var array - * - * @todo Pluginify. + * {@inheritdoc} */ - public $settings = array(); + public function id() { + return $this->type; + } /** * {@inheritdoc} */ - public function id() { - return $this->type; + public function isLocked() { + $locked = \Drupal::state()->get('node.type.locked'); + return isset($locked[$this->id()]) ? $locked[$this->id()] : FALSE; } /** * {@inheritdoc} */ - public function getModuleSettings($module) { - if (isset($this->settings[$module]) && is_array($this->settings[$module])) { - return $this->settings[$module]; - } - return array(); + public function isNewRevision() { + return $this->new_revision; } /** * {@inheritdoc} */ - public function isLocked() { - $locked = \Drupal::state()->get('node.type.locked'); - return isset($locked[$this->id()]) ? $locked[$this->id()] : FALSE; + public function setNewRevision($new_revision) { + $this->new_revision = $new_revision; + } + + /** + * {@inheritdoc} + */ + public function displaySubmitted() { + return $this->display_submitted; + } + + /** + * {@inheritdoc} + */ + public function setDisplaySubmitted($display_submtited) { + $this->display_submitted = $display_submtited; + } + + /** + * {@inheritdoc} + */ + public function getPreviewMode() { + return $this->preview_mode; + } + + /** + * {@inheritdoc} + */ + public function setPreviewMode($preview_mode) { + $this->preview_mode = $preview_mode; } /** @@ -173,23 +218,4 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti $storage->resetCache(array_keys($entities)); } - /** - * {@inheritdoc} - */ - public static function preCreate(EntityStorageInterface $storage, array &$values) { - parent::preCreate($storage, $values); - - // Ensure default values are set. - if (!isset($values['settings']['node'])) { - $values['settings']['node'] = array(); - } - $values['settings']['node'] = NestedArray::mergeDeep(array( - 'options' => array( - 'revision' => FALSE, - ), - 'preview' => DRUPAL_OPTIONAL, - 'submitted' => TRUE, - ), $values['settings']['node']); - } - } diff --git a/core/modules/node/src/NodeAccessControlHandler.php b/core/modules/node/src/NodeAccessControlHandler.php index 5deb5c97f4b75a3f092534a3f41ce7691098a6c6..af07c4cd14b854fa9c4c3aab6b7ce71cbb1e880d 100644 --- a/core/modules/node/src/NodeAccessControlHandler.php +++ b/core/modules/node/src/NodeAccessControlHandler.php @@ -148,8 +148,7 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_ if ($account->hasPermission('administer nodes')) { return TRUE; } - $node_type_settings = $items->getEntity()->type->entity->getModuleSettings('node'); - return !empty($node_type_settings['options']['revision']); + return $items->getEntity()->type->entity->isNewRevision(); } return parent::checkFieldAccess($operation, $field_definition, $account, $items); } diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index 7690b7c2a6d839ae7503f48345dbde61d0d4e4e5..d36e645d5b2c4571ea7e31833b3101adce36d86c 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -21,13 +21,6 @@ */ class NodeForm extends ContentEntityForm { - /** - * Default settings for this content/node type. - * - * @var array - */ - protected $settings; - /** * The tempstore factory. * @@ -64,9 +57,6 @@ public static function create(ContainerInterface $container) { protected function prepareEntity() { /** @var \Drupal\node\NodeInterface $node */ $node = $this->entity; - // Make node type settings easily accessible. - $type = $node->type->entity; - $this->settings = $type->getModuleSettings('node'); if (!$node->isNew()) { // Remove the revision log message from the original node entity. @@ -154,7 +144,7 @@ public function form(array $form, FormStateInterface $form_state) { $form['revision'] = array( '#type' => 'checkbox', '#title' => t('Create new revision'), - '#default_value' => !empty($this->settings['options']['revision']), + '#default_value' => $node->type->entity->isNewRevision(), '#access' => $current_user->hasPermission('administer nodes'), '#group' => 'revision_information', ); @@ -223,7 +213,7 @@ public function form(array $form, FormStateInterface $form_state) { protected function actions(array $form, FormStateInterface $form_state) { $element = parent::actions($form, $form_state); $node = $this->entity; - $preview_mode = $this->settings['preview']; + $preview_mode = $node->type->entity->getPreviewMode(); $element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || (!$form_state->getErrors() && isset($form_state['node_preview'])); diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php index 4088154f4e454f7d937e8970ad0ca05728efd13c..8694501fda0bd06f7854beed30bd763d37ffd7c3 100644 --- a/core/modules/node/src/NodeTypeForm.php +++ b/core/modules/node/src/NodeTypeForm.php @@ -68,7 +68,6 @@ public function form(array $form, FormStateInterface $form_state) { $node = $this->entityManager->getStorage('node')->create(array('type' => $type->id())); } - $node_settings = $type->getModuleSettings('node'); $form['name'] = array( '#title' => t('Name'), '#type' => 'textfield', @@ -118,11 +117,10 @@ 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' => $node_settings['preview'], + '#default_value' => $type->getPreviewMode(), '#options' => array( DRUPAL_DISABLED => t('Disabled'), DRUPAL_OPTIONAL => t('Optional'), @@ -144,7 +142,7 @@ public function form(array $form, FormStateInterface $form_state) { 'status' => $node->status->value, 'promote' => $node->promote->value, 'sticky' => $node->sticky->value, - 'revision' => $type->settings['node']['options']['revision'], + 'revision' => $type->isNewRevision(), ); // Prepare workflow options to be used for 'checkboxes' form element. $keys = array_keys(array_filter($workflow_options)); @@ -182,11 +180,10 @@ 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' => $node_settings['submitted'], + '#default_value' => $type->displaySubmitted(), '#description' => t('Author username and publish date will be displayed.'), ); return $form; @@ -220,7 +217,7 @@ public function validate(array $form, FormStateInterface $form_state) { */ public function save(array $form, FormStateInterface $form_state) { $type = $this->entity; - $type->settings['node']['options']['revision'] = $form_state['values']['options']['revision']; + $type->setNewRevision($form_state->getValue(array('options', 'revision'))); $type->type = trim($type->id()); $type->name = trim($type->name); diff --git a/core/modules/node/src/NodeTypeInterface.php b/core/modules/node/src/NodeTypeInterface.php index d828feb01bd59025c7b0cb41f702ca48ccbb2384..d113f87e461a8afa4ea1a17dadc40f9a29cc815f 100644 --- a/core/modules/node/src/NodeTypeInterface.php +++ b/core/modules/node/src/NodeTypeInterface.php @@ -8,30 +8,67 @@ namespace Drupal\node; use Drupal\Core\Config\Entity\ConfigEntityInterface; +use Drupal\Core\Config\Entity\ThirdPartySettingsInterface; /** * Provides an interface defining a node type entity. */ -interface NodeTypeInterface extends ConfigEntityInterface { +interface NodeTypeInterface extends ConfigEntityInterface, ThirdPartySettingsInterface { /** - * Returns the configured node type settings of a given module, if any. + * Determines whether the node type is locked. * - * @param string $module - * The name of the module whose settings to return. + * @return string|false + * The module name that locks the type or FALSE. + */ + public function isLocked(); + + /** + * Returns whether a new revision should be created by default. * - * @return array - * An associative array containing the module's settings for the node type. - * Note that this can be empty, and default values do not necessarily exist. + * @return bool + * TRUE if a new revision should be created by default. */ - public function getModuleSettings($module); + public function isNewRevision(); /** - * Determines whether the node type is locked. + * Set whether a new revision should be created by default. * - * @return string|false - * The module name that locks the type or FALSE. + * @param bool $new_revision_ + * TRUE if a new revision should be created by default. */ - public function isLocked(); + public function setNewRevision($new_revision); + + /** + * Returns whether 'Submitted by' information should be shown. + * + * @return bool + * TRUE if the submitted by information should be shown. + */ + public function displaySubmitted(); + + /** + * Set whether 'Submitted by' information should be shown. + * + * @param bool $display_submitted + * TRUE if the submitted by information should be shown. + */ + public function setDisplaySubmitted($display_submtited); + + /** + * Returns the preview mode. + * + * @return int + * DRUPAL_DISABLED, DRUPAL_OPTIONAL or DRUPAL_REQUIRED. + */ + public function getPreviewMode(); + + /** + * Sets the preview mode. + * + * @param int $preview_mode + * DRUPAL_DISABLED, DRUPAL_OPTIONAL or DRUPAL_REQUIRED. + */ + public function setPreviewMode($preview_mode); } diff --git a/core/modules/node/src/Tests/NodeCreationTest.php b/core/modules/node/src/Tests/NodeCreationTest.php index a6d22fdd96eef03386a44589400eab8a66dd48a2..d939dab1370afeb543a1451a1cf959cc0c9065c9 100644 --- a/core/modules/node/src/Tests/NodeCreationTest.php +++ b/core/modules/node/src/Tests/NodeCreationTest.php @@ -63,7 +63,7 @@ function testNodeCreation() { // Change the node type setting to show submitted by information. $node_type = entity_load('node_type', 'page'); - $node_type->settings['node']['submitted'] = TRUE; + $node_type->setDisplaySubmitted(TRUE); $node_type->save(); $this->drupalGet('node/' . $node->id()); diff --git a/core/modules/node/src/Tests/NodeFieldAccessTest.php b/core/modules/node/src/Tests/NodeFieldAccessTest.php index 44aaeda91727f1e6c25a22ad22d4f1415be377ff..bc1ef76eb782a0ea1fb540f2240072ffdba35456 100644 --- a/core/modules/node/src/Tests/NodeFieldAccessTest.php +++ b/core/modules/node/src/Tests/NodeFieldAccessTest.php @@ -53,26 +53,14 @@ function testAccessToAdministrativeFields() { // Create the page node type with revisions disabled. $page = NodeType::create([ 'type' => 'page', - 'settings' => array( - 'node' => array( - 'options' => array( - 'revision' => FALSE, - ), - ), - ), + 'new_revision' => FALSE, ]); $page->save(); // Create the article node type with revisions disabled. $article = NodeType::create([ 'type' => 'article', - 'settings' => array( - 'node' => array( - 'options' => array( - 'revision' => TRUE, - ), - ), - ), + 'new_revision' => TRUE, ]); $article->save(); diff --git a/core/modules/node/src/Tests/NodePostSettingsTest.php b/core/modules/node/src/Tests/NodePostSettingsTest.php index 35c3125edd5987c2f1deb4935f4a88f8a9f34030..0acee504d9fcf44778fce1a0c8deb446342e0246 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/src/Tests/NodeRevisionsUiTest.php b/core/modules/node/src/Tests/NodeRevisionsUiTest.php index f2bc337ac369876288eaa83c71766a95ccfc789f..c9a4a3675db5328caa2dd8af027d0c2e6fb9fae0 100644 --- a/core/modules/node/src/Tests/NodeRevisionsUiTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsUiTest.php @@ -39,7 +39,7 @@ function testNodeFormSaveWithoutRevision() { // Set page revision setting 'create new revision'. This will mean new // revisions are created by default when the node is edited. $type = entity_load('node_type', 'page'); - $type->settings['node']['options']['revision'] = TRUE; + $type->setNewRevision(TRUE); $type->save(); // Create the node. diff --git a/core/modules/node/src/Tests/NodeTestBase.php b/core/modules/node/src/Tests/NodeTestBase.php index 67585603cfdb14a57cc690a3f23a919cccabbd4e..764d0a818e9207df6bb3d660e6c582a6dfb430e5 100644 --- a/core/modules/node/src/Tests/NodeTestBase.php +++ b/core/modules/node/src/Tests/NodeTestBase.php @@ -34,12 +34,11 @@ protected 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 the page content type. - 'node' => array( - 'submitted' => FALSE, - ), - ))); + $this->drupalCreateContentType(array( + 'type' => 'page', + 'name' => 'Basic page', + 'display_submitted' => FALSE, + )); $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); } $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node'); diff --git a/core/modules/node/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php index aed67e4ca66f12f998649c8c10cbd4dbfaee8617..1370956f9ba7000e6dc14eea33dbb14fa55f5b1e 100644 --- a/core/modules/node/src/Tests/PagePreviewTest.php +++ b/core/modules/node/src/Tests/PagePreviewTest.php @@ -204,7 +204,7 @@ function testPagePreviewWithRevisions() { $term_key = $this->field_name; // Force revision on "Basic page" content. $node_type = NodeType::load('page'); - $node_type->settings['node']['options']['revision'] = TRUE; + $node_type->setNewRevision(TRUE); $node_type->save(); // Fill in node creation form and preview node. diff --git a/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php b/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php index c77df9c3a5db076c3f78bbaadfa5de15e0965c3e..bb018954601cbc89e8c7ee8b3b040397ef40d1ea 100644 --- a/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php +++ b/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php @@ -35,6 +35,7 @@ class NodeContextualLinksTest extends NodeTestBase { * Tests contextual links. */ public function testNodeContextualLinks() { + $this->drupalCreateContentType(array('type' => 'page')); $this->drupalCreateNode(array('promote' => 1)); $this->drupalGet('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 2003aad70f3dd200b007f8fe097f199c21fb0434..33d62b336a7f014c3ee85860b898fdd3a5f1f9b7 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 @@ -2,11 +2,8 @@ type: default name: Default description: 'Default description.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: true +new_revision: false +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 9bab192b22676d741947d6fe78c8232226b4abaf..f1bafe46d224d045d1bb153fb9c4241fa2ee248f 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 @@ -2,11 +2,8 @@ type: import name: Import description: 'Import description.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: true +new_revision: false +display_submitted: true +preview_mode: 1 status: true langcode: en diff --git a/core/modules/quickedit/src/Form/QuickEditFieldForm.php b/core/modules/quickedit/src/Form/QuickEditFieldForm.php index a5c4b38b60407797ea6f46ccb08a305902a35337..d4fc95e07e654ec7cf6892e286240ab1cc918a5d 100644 --- a/core/modules/quickedit/src/Form/QuickEditFieldForm.php +++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php @@ -121,9 +121,8 @@ protected function init(FormStateInterface $form_state, EntityInterface $entity, // @todo Rather than special-casing $node->revision, invoke prepareEdit() // once http://drupal.org/node/1863258 lands. if ($entity->getEntityTypeId() == 'node') { - $node_type_settings = $this->nodeTypeStorage->load($entity->bundle())->getModuleSettings('node'); - $options = (isset($node_type_settings['options'])) ? $node_type_settings['options'] : array(); - $entity->setNewRevision(!empty($options['revision'])); + $node_type = $this->nodeTypeStorage->load($entity->bundle()); + $entity->setNewRevision($node_type->isNewRevision()); $entity->revision_log = NULL; } diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php index 1f398425106948f1636ff30060963b3dbec70078..6a084f620e6d07c3f74970addd824714d047b414 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 2b297a47b230ce101e03de99822491bae3ca9219..d097a5e593b96e8b4eca1cc8999ed7621bac6eec 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/rdf/src/Tests/UserAttributesTest.php b/core/modules/rdf/src/Tests/UserAttributesTest.php index 64c306b055b4dde7610a1a056d4dc741b8effcda..840701a238073cbe244ac71a62c9c3915f4befce 100644 --- a/core/modules/rdf/src/Tests/UserAttributesTest.php +++ b/core/modules/rdf/src/Tests/UserAttributesTest.php @@ -55,6 +55,8 @@ function testUserAttributesInMarkup() { $this->drupalLogin($user1); + $this->drupalCreateContentType(array('type' => 'article')); + foreach($authors as $author) { $account_uri = url('user/' . $author->id(), array('absolute' => TRUE)); diff --git a/core/modules/statistics/src/Tests/Views/IntegrationTest.php b/core/modules/statistics/src/Tests/Views/IntegrationTest.php index 5ef8610e0ff0d9d368ac6d1a3e690c20b9197d62..b26745a971c18cf8dd2f820d309383b497cb0a31 100644 --- a/core/modules/statistics/src/Tests/Views/IntegrationTest.php +++ b/core/modules/statistics/src/Tests/Views/IntegrationTest.php @@ -55,6 +55,7 @@ protected function setUp() { // Create a new user for viewing nodes. $this->webUser = $this->drupalCreateUser(array('access content')); + $this->drupalCreateContentType(array('type' => 'page')); $this->node = $this->drupalCreateNode(array('type' => 'page')); // Enable access logging. diff --git a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php index 6580e578d6f3a240175dd65df18a1ab2623e9ec0..ea5566261de94409e0e069afb3f711bc4dcd6304 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/modules/system/src/Tests/System/DateTimeTest.php b/core/modules/system/src/Tests/System/DateTimeTest.php index a14d0024e68831bbf66813610b6d03f4cc010c93..416a147543496d389a30a3615516035e4937ff57 100644 --- a/core/modules/system/src/Tests/System/DateTimeTest.php +++ b/core/modules/system/src/Tests/System/DateTimeTest.php @@ -48,6 +48,7 @@ function testTimeZoneHandling() { // Create some nodes with different authored-on dates. $date1 = '2007-01-31 21:00:00 -1000'; $date2 = '2007-07-31 21:00:00 -1000'; + $this->drupalCreateContentType(array('type' => 'article')); $node1 = $this->drupalCreateNode(array('created' => strtotime($date1), 'type' => 'article')); $node2 = $this->drupalCreateNode(array('created' => strtotime($date2), 'type' => 'article')); diff --git a/core/modules/system/src/Tests/System/FrontPageTest.php b/core/modules/system/src/Tests/System/FrontPageTest.php index aeb758cdd607f64f8b56dffef9e7acb383c71a1b..dd24ef505317b0ab74eb5fa1ec39aedfed7286d8 100644 --- a/core/modules/system/src/Tests/System/FrontPageTest.php +++ b/core/modules/system/src/Tests/System/FrontPageTest.php @@ -29,6 +29,7 @@ protected function setUp() { // Create admin user, log in admin user, and create one node. $this->admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration')); $this->drupalLogin($this->admin_user); + $this->drupalCreateContentType(array('type' => 'page')); $this->node_path = "node/" . $this->drupalCreateNode(array('promote' => 1))->id(); // Configure 'node' as front page. diff --git a/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php index efb081803c78878d025b8b3a77fa522b959c61bf..102f5429bee4a30ecfe349fee5b236c551fb145c 100644 --- a/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php +++ b/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php @@ -30,6 +30,7 @@ function testTwigDebugMarkup() { $extension = twig_extension(); theme_enable(array('test_theme')); \Drupal::config('system.theme')->set('default', 'test_theme')->save(); + $this->drupalCreateContentType(array('type' => 'page')); // Enable debug, rebuild the service container, and clear all caches. $parameters = $this->container->getParameter('twig.config'); $parameters['debug'] = TRUE; diff --git a/core/modules/user/src/Tests/UserTimeZoneTest.php b/core/modules/user/src/Tests/UserTimeZoneTest.php index f3ea2975810034e71f2cf45d04c15583d0c6e056..4c09de008566c3f845dd28a65276c03e1cf778fa 100644 --- a/core/modules/user/src/Tests/UserTimeZoneTest.php +++ b/core/modules/user/src/Tests/UserTimeZoneTest.php @@ -46,6 +46,7 @@ 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')); $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')); diff --git a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php index c0f3a05b8f2254af2c525f58fee0d020e36ff21d..7dbc9875f39a43a509cc73d55260e1a3721e7ff9 100644 --- a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php +++ b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php @@ -8,6 +8,7 @@ namespace Drupal\views\Tests\Entity; use Drupal\Core\Language\Language; +use Drupal\node\Entity\NodeType; use Drupal\views\Tests\ViewUnitTestBase; use Drupal\views\Views; @@ -63,9 +64,9 @@ protected function setUp() { } // Make sure we do not try to render non-existing user data. - $config = \Drupal::config('node.type.test'); - $config->set('settings.node.submitted', FALSE); - $config->save(); + $node_type = NodeType::create(array('type' => 'test')); + $node_type->setDisplaySubmitted(FALSE); + $node_type->save(); } /** diff --git a/core/modules/views/src/Tests/Plugin/MiniPagerTest.php b/core/modules/views/src/Tests/Plugin/MiniPagerTest.php index f8263a08b8dba3b86f69113ac7883fba9870beb1..f6f31c428ca04104e91f63f48f9c6b2be4bc8af0 100644 --- a/core/modules/views/src/Tests/Plugin/MiniPagerTest.php +++ b/core/modules/views/src/Tests/Plugin/MiniPagerTest.php @@ -41,6 +41,7 @@ class MiniPagerTest extends PluginTestBase { protected function setUp() { parent::setUp(); + $this->drupalCreateContentType(array('type' => 'page')); // Create a bunch of test nodes. for ($i = 0; $i < 20; $i++) { $this->nodes[] = $this->drupalCreateNode(); diff --git a/core/modules/views/src/Tests/Plugin/PagerTest.php b/core/modules/views/src/Tests/Plugin/PagerTest.php index 7a14e5432321fbfd2f6b22c2abdf3559063478a8..20e0718aaa120aee99649c201b83f743a60e7936 100644 --- a/core/modules/views/src/Tests/Plugin/PagerTest.php +++ b/core/modules/views/src/Tests/Plugin/PagerTest.php @@ -111,6 +111,7 @@ public function testStorePagerSettings() { public function testNoLimit() { // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } @@ -139,6 +140,7 @@ public function testNoLimit() { } public function testViewTotalRowsWithoutPager() { + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 23; $i++) { $this->drupalCreateNode(); } @@ -156,6 +158,7 @@ public function testViewTotalRowsWithoutPager() { public function testLimit() { // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } @@ -189,6 +192,7 @@ public function testLimit() { public function testNormalPager() { // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } @@ -243,6 +247,7 @@ public function testNormalPager() { public function testRenderNullPager() { // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } diff --git a/core/modules/views/src/Tests/Wizard/SortingTest.php b/core/modules/views/src/Tests/Wizard/SortingTest.php index b5d236a985b79991c88838ea0ece20e9ec8bbadf..eb6cc98284fb16b58aa9d4c57a93f016b7a6ad19 100644 --- a/core/modules/views/src/Tests/Wizard/SortingTest.php +++ b/core/modules/views/src/Tests/Wizard/SortingTest.php @@ -20,6 +20,7 @@ class SortingTest extends WizardTestBase { function testSorting() { // Create nodes, each with a different creation time so that we can do a // meaningful sort. + $this->drupalCreateContentType(array('type' => 'page')); $node1 = $this->drupalCreateNode(array('created' => REQUEST_TIME)); $node2 = $this->drupalCreateNode(array('created' => REQUEST_TIME + 1)); $node3 = $this->drupalCreateNode(array('created' => REQUEST_TIME + 2)); diff --git a/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php b/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php index 3b2ecf7df8ebbe261f37f0643b23450af49cf69e..a3d4396c2d107bb837458bc6bf6fa808e603c31e 100644 --- a/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php +++ b/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php @@ -40,6 +40,7 @@ function testOverrideDisplays() { // Add a node that will appear in the view, so that the block will actually // be displayed. + $this->drupalCreateContentType(array('type' => 'page')); $this->drupalCreateNode(); // Make sure the title appears in the page. @@ -92,6 +93,7 @@ function testWizardMixedDefaultOverriddenDisplays() { // Add a node that will appear in the view, so that the block will actually // be displayed. + $this->drupalCreateContentType(array('type' => 'page')); $this->drupalCreateNode(); // Make sure that the feed, page and block all start off with the correct diff --git a/core/modules/views_ui/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php index f133354f9df6aabbd4663144133f2ca313d453f7..c681ec4edd86509a9503c205bfba07b61e17a2b5 100644 --- a/core/modules/views_ui/src/Tests/PreviewTest.php +++ b/core/modules/views_ui/src/Tests/PreviewTest.php @@ -98,6 +98,7 @@ function testPreviewUI() { public function testPreviewWithPagersUI() { // Create 11 nodes and make sure that everyone is returned. + $this->drupalCreateContentType(array('type' => 'page')); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } diff --git a/core/profiles/standard/config/install/node.type.article.yml b/core/profiles/standard/config/install/node.type.article.yml index 6f4f302cc2ad16c755f3c7678180bb2844b24602..7cb127db652119fd3c003cdfe065f36d86cdde56 100644 --- a/core/profiles/standard/config/install/node.type.article.yml +++ b/core/profiles/standard/config/install/node.type.article.yml @@ -2,11 +2,8 @@ type: article name: Article description: 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: true +new_revision: false +preview_mode: 1 +display_submitted: true status: true langcode: en diff --git a/core/profiles/standard/config/install/node.type.page.yml b/core/profiles/standard/config/install/node.type.page.yml index 61ae323bae309479277eac7824ee473068a2beb6..f9b4353b45c8599eb33c83caa572fe5a9a99e3e3 100644 --- a/core/profiles/standard/config/install/node.type.page.yml +++ b/core/profiles/standard/config/install/node.type.page.yml @@ -2,11 +2,8 @@ type: page name: 'Basic page' description: 'Use <em>basic pages</em> for your static content, such as an ''About us'' page.' help: '' -settings: - node: - preview: 1 - options: - revision: false - submitted: false +new_revision: false +preview_mode: 1 +display_submitted: false status: true langcode: en