diff --git a/core/modules/book/config/install/entity.form_display.node.book.default.yml b/core/modules/book/config/install/entity.form_display.node.book.default.yml
new file mode 100644
index 0000000..1175058
--- /dev/null
+++ b/core/modules/book/config/install/entity.form_display.node.book.default.yml
@@ -0,0 +1,29 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.book.body
+ - node.type.book
+ module:
+ - text
+id: node.book.default
+targetEntityType: node
+bundle: book
+mode: default
+content:
+ title:
+ type: string
+ weight: -5
+ settings:
+ size: 60
+ placeholder: ''
+ third_party_settings: { }
+ body:
+ type: text_textarea_with_summary
+ weight: -4
+ settings:
+ rows: 9
+ summary_rows: 3
+ placeholder: ''
+ third_party_settings: { }
+hidden: { }
diff --git a/core/modules/book/config/install/entity.view_display.node.book.default.yml b/core/modules/book/config/install/entity.view_display.node.book.default.yml
new file mode 100644
index 0000000..467a4f6
--- /dev/null
+++ b/core/modules/book/config/install/entity.view_display.node.book.default.yml
@@ -0,0 +1,22 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.book.body
+ - node.type.book
+ module:
+ - text
+id: node.book.default
+label: null
+targetEntityType: node
+bundle: book
+mode: default
+content:
+ body:
+ label: hidden
+ type: text_default
+ weight: -4
+ settings: { }
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/core/modules/book/config/install/entity.view_display.node.book.teaser.yml b/core/modules/book/config/install/entity.view_display.node.book.teaser.yml
new file mode 100644
index 0000000..a8379ca
--- /dev/null
+++ b/core/modules/book/config/install/entity.view_display.node.book.teaser.yml
@@ -0,0 +1,24 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - entity.view_mode.node.teaser
+ - field.instance.node.book.body
+ - node.type.book
+ module:
+ - text
+id: node.book.teaser
+label: null
+targetEntityType: node
+bundle: book
+mode: teaser
+content:
+ body:
+ label: hidden
+ type: text_summary_or_trimmed
+ weight: -4
+ settings:
+ trim_length: 600
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/core/modules/book/config/install/field.instance.node.book.body.yml b/core/modules/book/config/install/field.instance.node.book.body.yml
new file mode 100644
index 0000000..3c422c4
--- /dev/null
+++ b/core/modules/book/config/install/field.instance.node.book.body.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.body
+ - node.type.book
+id: node.book.body
+label: Body
+field_name: body
+entity_type: node
+bundle: book
+description: ''
+required: false
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ display_summary: true
+ text_processing: true
+field_type: text_with_summary
diff --git a/core/modules/book/config/install/node.type.book.yml b/core/modules/book/config/install/node.type.book.yml
index d2409d4..b0a6c09 100644
--- a/core/modules/book/config/install/node.type.book.yml
+++ b/core/modules/book/config/install/node.type.book.yml
@@ -1,17 +1,18 @@
-type: book
+langcode: en
+status: true
+dependencies: { }
name: 'Book page'
+type: book
description: 'Books have a built-in hierarchical navigation. Use for handbooks or tutorials.'
help: ''
title_label: Title
settings:
node:
- preview: 1
options:
status: true
# Not promoted to front page.
promote: false
sticky: false
revision: false
+ preview: 1
submitted: true
-status: true
-langcode: en
diff --git a/core/modules/config/src/Tests/ConfigImportRecreateTest.php b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
index 4dcf90c..264c87f 100644
--- a/core/modules/config/src/Tests/ConfigImportRecreateTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
@@ -65,6 +65,7 @@ public function testRecreateEntity() {
'name' => 'Node type one',
));
$content_type->save();
+ node_add_body_field($content_type);
/** @var \Drupal\Core\Config\StorageInterface $active */
$active = $this->container->get('config.storage');
/** @var \Drupal\Core\Config\StorageInterface $staging */
@@ -83,6 +84,7 @@ public function testRecreateEntity() {
'name' => 'Node type two',
));
$content_type->save();
+ node_add_body_field($content_type);
$this->configImporter->reset();
// A node type, a field, a field instance an entity view display and an
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
index 444274b..2280b4e 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
@@ -232,11 +232,10 @@ public function doContactFormsListTest() {
public function doContentTypeListTest() {
// Create a test content type to decouple looking for translate operations
// link so this does not test more than necessary.
- $content_type = entity_create('node_type', array(
+ $content_type = $this->drupalCreateContentType(array(
'type' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(),
));
- $content_type->save();
// Get the content type listing.
$this->drupalGet('admin/structure/types');
@@ -384,11 +383,10 @@ public function doResponsiveImageListTest() {
*/
public function doFieldListTest() {
// Create a base content type.
- $content_type = entity_create('node_type', array(
+ $content_type = $this->drupalCreateContentType(array(
'type' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(),
));
- $content_type->save();
// Look at a few fields on a few entity types.
$pages = array(
diff --git a/core/modules/editor/src/Tests/EditorFileUsageTest.php b/core/modules/editor/src/Tests/EditorFileUsageTest.php
index c9721d9..ec0a2dc 100644
--- a/core/modules/editor/src/Tests/EditorFileUsageTest.php
+++ b/core/modules/editor/src/Tests/EditorFileUsageTest.php
@@ -49,6 +49,7 @@ public function setUp() {
// Create a node type for testing.
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
$type->save();
+ node_add_body_field($type);
}
/**
diff --git a/core/modules/entity/src/Tests/EntityDisplayTest.php b/core/modules/entity/src/Tests/EntityDisplayTest.php
index 1efa671..ea224ab 100644
--- a/core/modules/entity/src/Tests/EntityDisplayTest.php
+++ b/core/modules/entity/src/Tests/EntityDisplayTest.php
@@ -265,12 +265,13 @@ public function testRenameDeleteBundle() {
$this->installEntitySchema('node');
// Create a node bundle, display and form display object.
- entity_create('node_type', array('type' => 'article'))->save();
+ $type = entity_create('node_type', array('type' => 'article'));
+ $type->save();
+ node_add_body_field($type);
entity_get_display('node', 'article', 'default')->save();
entity_get_form_display('node', 'article', 'default')->save();
// Rename the article bundle and assert the entity display is renamed.
- $type = node_type_load('article');
$type->old_type = 'article';
$type->type = 'article_rename';
$type->save();
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index 81b8e1b..e7c2d88 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -361,12 +361,10 @@ function testSingleViewMode() {
*/
function testNoFieldsDisplayOverview() {
// Create a fresh content type without any fields.
- $this->drupalCreateContentType(array(
+ entity_create('node_type', array(
'type' => 'no_fields',
'name' => 'No fields',
- 'create_body' => FALSE,
- ));
-
+ ))->save();
$this->drupalGet('admin/structure/types/manage/no_fields/display');
$this->assertRaw(t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => url('admin/structure/types/manage/no_fields/fields'))));
}
diff --git a/core/modules/forum/config/install/comment.type.comment_forum.yml b/core/modules/forum/config/install/comment.type.comment_forum.yml
new file mode 100644
index 0000000..fed6de3
--- /dev/null
+++ b/core/modules/forum/config/install/comment.type.comment_forum.yml
@@ -0,0 +1,7 @@
+langcode: en
+status: true
+dependencies: { }
+id: comment_forum
+label: Comment_forum
+target_entity_type_id: node
+description: 'Default comment field'
diff --git a/core/modules/forum/config/install/entity.form_display.comment.comment_forum.default.yml b/core/modules/forum/config/install/entity.form_display.comment.comment_forum.default.yml
new file mode 100644
index 0000000..b83f272
--- /dev/null
+++ b/core/modules/forum/config/install/entity.form_display.comment.comment_forum.default.yml
@@ -0,0 +1,30 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - comment.type.comment_forum
+ - field.instance.comment.comment_forum.comment_body
+ module:
+ - text
+id: comment.comment_forum.default
+targetEntityType: comment
+bundle: comment_forum
+mode: default
+content:
+ author:
+ weight: -2
+ subject:
+ type: string
+ weight: 10
+ settings:
+ size: 60
+ placeholder: ''
+ third_party_settings: { }
+ comment_body:
+ type: text_textarea
+ weight: 11
+ settings:
+ rows: 5
+ placeholder: ''
+ third_party_settings: { }
+hidden: { }
diff --git a/core/modules/forum/config/install/entity.form_display.node.forum.default.yml b/core/modules/forum/config/install/entity.form_display.node.forum.default.yml
new file mode 100644
index 0000000..1445715
--- /dev/null
+++ b/core/modules/forum/config/install/entity.form_display.node.forum.default.yml
@@ -0,0 +1,43 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.forum.body
+ - field.instance.node.forum.comment_forum
+ - field.instance.node.forum.taxonomy_forums
+ - node.type.forum
+ module:
+ - comment
+ - options
+ - text
+id: node.forum.default
+targetEntityType: node
+bundle: forum
+mode: default
+content:
+ title:
+ type: string
+ weight: -5
+ settings:
+ size: 60
+ placeholder: ''
+ third_party_settings: { }
+ body:
+ type: text_textarea_with_summary
+ weight: -4
+ settings:
+ rows: 9
+ summary_rows: 3
+ placeholder: ''
+ third_party_settings: { }
+ taxonomy_forums:
+ type: options_select
+ weight: -3
+ settings: { }
+ third_party_settings: { }
+ comment_forum:
+ type: comment_default
+ weight: 20
+ settings: { }
+ third_party_settings: { }
+hidden: { }
diff --git a/core/modules/forum/config/install/entity.form_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/entity.form_display.taxonomy_term.forums.default.yml
index d295232..657cfea 100644
--- a/core/modules/forum/config/install/entity.form_display.taxonomy_term.forums.default.yml
+++ b/core/modules/forum/config/install/entity.form_display.taxonomy_term.forums.default.yml
@@ -1,8 +1,14 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - taxonomy.vocabulary.forums
+ module:
+ - text
id: taxonomy_term.forums.default
targetEntityType: taxonomy_term
bundle: forums
mode: default
-status: true
content:
name:
type: string
@@ -14,8 +20,6 @@ content:
description:
type: text_textfield
weight: 0
- settings: { }
+ settings: { }
third_party_settings: { }
-dependencies:
- entity:
- - taxonomy.vocabulary.forums
+hidden: { }
diff --git a/core/modules/forum/config/install/entity.view_display.comment.comment_forum.default.yml b/core/modules/forum/config/install/entity.view_display.comment.comment_forum.default.yml
new file mode 100644
index 0000000..a36bf0e
--- /dev/null
+++ b/core/modules/forum/config/install/entity.view_display.comment.comment_forum.default.yml
@@ -0,0 +1,21 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - comment.type.comment_forum
+ - field.instance.comment.comment_forum.comment_body
+ module:
+ - text
+id: comment.comment_forum.default
+label: null
+targetEntityType: comment
+bundle: comment_forum
+mode: default
+content:
+ comment_body:
+ label: hidden
+ type: text_default
+ weight: 0
+ settings: { }
+ third_party_settings: { }
+hidden: { }
diff --git a/core/modules/forum/config/install/entity.view_display.node.forum.default.yml b/core/modules/forum/config/install/entity.view_display.node.forum.default.yml
new file mode 100644
index 0000000..997f0a4
--- /dev/null
+++ b/core/modules/forum/config/install/entity.view_display.node.forum.default.yml
@@ -0,0 +1,39 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.forum.body
+ - field.instance.node.forum.comment_forum
+ - field.instance.node.forum.taxonomy_forums
+ - node.type.forum
+ module:
+ - comment
+ - taxonomy
+ - text
+id: node.forum.default
+label: null
+targetEntityType: node
+bundle: forum
+mode: default
+content:
+ body:
+ label: hidden
+ type: text_default
+ weight: -4
+ settings: { }
+ third_party_settings: { }
+ taxonomy_forums:
+ type: taxonomy_term_reference_link
+ weight: 10
+ label: above
+ settings: { }
+ third_party_settings: { }
+ comment_forum:
+ label: hidden
+ type: comment_default
+ weight: 20
+ settings:
+ pager_id: '0'
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/core/modules/forum/config/install/entity.view_display.node.forum.teaser.yml b/core/modules/forum/config/install/entity.view_display.node.forum.teaser.yml
new file mode 100644
index 0000000..eb7c31f
--- /dev/null
+++ b/core/modules/forum/config/install/entity.view_display.node.forum.teaser.yml
@@ -0,0 +1,34 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - entity.view_mode.node.teaser
+ - field.instance.node.forum.body
+ - field.instance.node.forum.comment_forum
+ - field.instance.node.forum.taxonomy_forums
+ - node.type.forum
+ module:
+ - taxonomy
+ - text
+id: node.forum.teaser
+label: null
+targetEntityType: node
+bundle: forum
+mode: teaser
+content:
+ body:
+ label: hidden
+ type: text_summary_or_trimmed
+ weight: -4
+ settings:
+ trim_length: 600
+ third_party_settings: { }
+ taxonomy_forums:
+ type: taxonomy_term_reference_link
+ weight: 10
+ label: above
+ settings: { }
+ third_party_settings: { }
+hidden:
+ langcode: true
+ comment_forum: true
diff --git a/core/modules/forum/config/install/entity.view_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/entity.view_display.taxonomy_term.forums.default.yml
index f2f5b61..e2176e2 100644
--- a/core/modules/forum/config/install/entity.view_display.taxonomy_term.forums.default.yml
+++ b/core/modules/forum/config/install/entity.view_display.taxonomy_term.forums.default.yml
@@ -1,8 +1,15 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - taxonomy.vocabulary.forums
+ module:
+ - text
id: taxonomy_term.forums.default
+label: null
targetEntityType: taxonomy_term
bundle: forums
mode: default
-status: true
content:
description:
type: text_default
@@ -11,7 +18,3 @@ content:
third_party_settings: { }
label: above
hidden: { }
-status: true
-dependencies:
- entity:
- - taxonomy.vocabulary.forums
diff --git a/core/modules/forum/config/install/field.instance.comment.comment_forum.comment_body.yml b/core/modules/forum/config/install/field.instance.comment.comment_forum.comment_body.yml
new file mode 100644
index 0000000..d3809b5
--- /dev/null
+++ b/core/modules/forum/config/install/field.instance.comment.comment_forum.comment_body.yml
@@ -0,0 +1,19 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - comment.type.comment_forum
+ - field.storage.comment.comment_body
+id: comment.comment_forum.comment_body
+label: Comment
+field_name: comment_body
+entity_type: comment
+bundle: comment_forum
+description: ''
+required: true
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ text_processing: '1'
+field_type: text_long
diff --git a/core/modules/forum/config/install/field.instance.node.forum.body.yml b/core/modules/forum/config/install/field.instance.node.forum.body.yml
new file mode 100644
index 0000000..3a9301b
--- /dev/null
+++ b/core/modules/forum/config/install/field.instance.node.forum.body.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.body
+ - node.type.forum
+id: node.forum.body
+label: Body
+field_name: body
+entity_type: node
+bundle: forum
+description: ''
+required: false
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ display_summary: true
+ text_processing: true
+field_type: text_with_summary
diff --git a/core/modules/forum/config/install/field.instance.node.forum.comment_forum.yml b/core/modules/forum/config/install/field.instance.node.forum.comment_forum.yml
new file mode 100644
index 0000000..69c1d86
--- /dev/null
+++ b/core/modules/forum/config/install/field.instance.node.forum.comment_forum.yml
@@ -0,0 +1,30 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.comment_forum
+ - node.type.forum
+id: node.forum.comment_forum
+label: Comments
+field_name: comment_forum
+entity_type: node
+bundle: forum
+description: ''
+required: true
+translatable: true
+default_value:
+ -
+ status: 2
+ cid: 0
+ last_comment_name: null
+ last_comment_timestamp: 0
+ last_comment_uid: 0
+ comment_count: 0
+default_value_function: ''
+settings:
+ default_mode: false
+ per_page: 50
+ form_location: true
+ anonymous: 0
+ preview: 1
+field_type: comment
diff --git a/core/modules/forum/config/install/field.instance.node.forum.taxonomy_forums.yml b/core/modules/forum/config/install/field.instance.node.forum.taxonomy_forums.yml
new file mode 100644
index 0000000..3f95d2a
--- /dev/null
+++ b/core/modules/forum/config/install/field.instance.node.forum.taxonomy_forums.yml
@@ -0,0 +1,19 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.taxonomy_forums
+ - node.type.forum
+id: node.forum.taxonomy_forums
+label: Forums
+field_name: taxonomy_forums
+entity_type: node
+bundle: forum
+description: ''
+required: true
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ handler: default
+field_type: taxonomy_term_reference
diff --git a/core/modules/forum/config/install/field.instance.taxonomy_term.forums.forum_container.yml b/core/modules/forum/config/install/field.instance.taxonomy_term.forums.forum_container.yml
index b1c47ea..a8d74bf 100644
--- a/core/modules/forum/config/install/field.instance.taxonomy_term.forums.forum_container.yml
+++ b/core/modules/forum/config/install/field.instance.taxonomy_term.forums.forum_container.yml
@@ -1,19 +1,20 @@
-id: taxonomy_term.forums.forum_container
-status: true
langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.taxonomy_term.forum_container
+ - taxonomy.vocabulary.forums
+id: taxonomy_term.forums.forum_container
+label: Container
+field_name: forum_container
entity_type: taxonomy_term
bundle: forums
-field_name: forum_container
-label: Container
description: ''
required: true
+translatable: true
default_value:
-
value: 0
default_value_function: ''
settings: { }
field_type: boolean
-dependencies:
- entity:
- - field.storage.taxonomy_term.forum_container
- - taxonomy.vocabulary.forums
diff --git a/core/modules/forum/config/install/field.storage.node.comment_forum.yml b/core/modules/forum/config/install/field.storage.node.comment_forum.yml
new file mode 100644
index 0000000..57c6750
--- /dev/null
+++ b/core/modules/forum/config/install/field.storage.node.comment_forum.yml
@@ -0,0 +1,17 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - comment
+ - node
+id: node.comment_forum
+name: comment_forum
+entity_type: node
+type: comment
+settings:
+ comment_type: comment_forum
+module: comment
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
diff --git a/core/modules/forum/config/install/field.storage.node.taxonomy_forums.yml b/core/modules/forum/config/install/field.storage.node.taxonomy_forums.yml
new file mode 100644
index 0000000..f338e07
--- /dev/null
+++ b/core/modules/forum/config/install/field.storage.node.taxonomy_forums.yml
@@ -0,0 +1,23 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ - taxonomy
+id: node.taxonomy_forums
+name: taxonomy_forums
+entity_type: node
+type: taxonomy_term_reference
+settings:
+ allowed_values:
+ -
+ vocabulary: forums
+ parent: 0
+ target_type: taxonomy_term
+ options_list_callback: null
+ target_bundle: null
+module: taxonomy
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
diff --git a/core/modules/forum/config/install/field.storage.taxonomy_term.forum_container.yml b/core/modules/forum/config/install/field.storage.taxonomy_term.forum_container.yml
index a5d8164..7263da4 100644
--- a/core/modules/forum/config/install/field.storage.taxonomy_term.forum_container.yml
+++ b/core/modules/forum/config/install/field.storage.taxonomy_term.forum_container.yml
@@ -1,18 +1,17 @@
-id: taxonomy_term.forum_container
-status: true
langcode: en
+status: true
+dependencies:
+ module:
+ - taxonomy
+id: taxonomy_term.forum_container
name: forum_container
+entity_type: taxonomy_term
type: boolean
settings:
on_label: Yes
off_label: No
-module: options
-entity_type: taxonomy_term
+module: core
locked: true
cardinality: 1
translatable: false
indexes: { }
-dependencies:
- module:
- - options
- - taxonomy
diff --git a/core/modules/forum/config/install/node.type.forum.yml b/core/modules/forum/config/install/node.type.forum.yml
index f2e86af..3b5615a 100644
--- a/core/modules/forum/config/install/node.type.forum.yml
+++ b/core/modules/forum/config/install/node.type.forum.yml
@@ -1,17 +1,17 @@
-type: forum
+langcode: en
+status: true
+dependencies: { }
name: 'Forum topic'
+type: forum
description: 'A forum topic starts a new discussion thread within a forum.'
help: ''
title_label: Subject
settings:
node:
- preview: 1
options:
status: true
- # Not promoted to front page.
promote: false
sticky: false
revision: false
+ preview: 1
submitted: true
-status: true
-langcode: en
diff --git a/core/modules/forum/config/install/taxonomy.vocabulary.forums.yml b/core/modules/forum/config/install/taxonomy.vocabulary.forums.yml
index 74d64ca..571b895 100644
--- a/core/modules/forum/config/install/taxonomy.vocabulary.forums.yml
+++ b/core/modules/forum/config/install/taxonomy.vocabulary.forums.yml
@@ -1,7 +1,8 @@
-vid: forums
+langcode: en
+status: true
+dependencies: { }
name: Forums
+vid: forums
description: 'Forum navigation vocabulary'
hierarchy: 1
weight: -10
-status: true
-langcode: en
diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install
index 2ebc79f..9fc9500 100644
--- a/core/modules/forum/forum.install
+++ b/core/modules/forum/forum.install
@@ -22,88 +22,15 @@ function forum_install() {
\Drupal::state()->set('node.type.locked', $locked);
if (!\Drupal::service('config.installer')->isSyncing()) {
- // Create the 'taxonomy_forums' field if it doesn't already exist. If forum
- // is being enabled at the same time as taxonomy after both modules have been
- // enabled, the field might exist but still be marked inactive.
- if (!FieldStorageConfig::loadByName('node', 'taxonomy_forums')) {
- entity_create('field_storage_config', array(
- 'name' => 'taxonomy_forums',
- 'entity_type' => 'node',
- 'type' => 'taxonomy_term_reference',
- 'settings' => array(
- 'allowed_values' => array(
- array(
- 'vocabulary' => 'forums',
- 'parent' => 0,
- ),
- ),
- ),
- ))->save();
-
- // Create a default forum so forum posts can be created.
- $term = entity_create('taxonomy_term', array(
- 'name' => t('General discussion'),
- 'description' => '',
- 'parent' => array(0),
- 'vid' => 'forums',
- 'forum_container' => 0,
- ));
- $term->save();
-
- // Create the instance on the bundle.
- entity_create('field_instance_config', array(
- 'field_name' => 'taxonomy_forums',
- 'entity_type' => 'node',
- 'label' => 'Forums',
- 'bundle' => 'forum',
- 'required' => TRUE,
- ))->save();
-
- // Assign form display settings for the 'default' form mode.
- entity_get_form_display('node', 'forum', 'default')
- ->setComponent('taxonomy_forums', array(
- 'type' => 'options_select',
- ))
- ->save();
-
- // Assign display settings for the 'default' and 'teaser' view modes.
- entity_get_display('node', 'forum', 'default')
- ->setComponent('taxonomy_forums', array(
- 'type' => 'taxonomy_term_reference_link',
- 'weight' => 10,
- ))
- ->save();
-
- entity_get_display('node', 'forum', 'teaser')
- ->setComponent('taxonomy_forums', array(
- 'type' => 'taxonomy_term_reference_link',
- 'weight' => 10,
- ))
- ->save();
- }
- // Add the comment field to the forum node type.
- $field_storages = entity_load_multiple_by_properties('field_storage_config', array(
- 'type' => 'comment',
- 'name' => 'comment_forum',
- 'include_deleted' => FALSE,
+ // Create a default forum so forum posts can be created.
+ $term = entity_create('taxonomy_term', array(
+ 'name' => t('General discussion'),
+ 'description' => '',
+ 'parent' => array(0),
+ 'vid' => 'forums',
+ 'forum_container' => 0,
));
- if (empty($field_storages)) {
- Drupal::service('comment.manager')->addDefaultField('node', 'forum', 'comment_forum', CommentItemInterface::OPEN, 'comment_forum');
-
- // Add here because we don't have param in addDefaultField function.
- $instance = FieldInstanceConfig::loadByName('node', 'forum', 'comment_forum');
- $instance->settings['default_mode'] = CommentManagerInterface::COMMENT_MODE_FLAT;
- $instance->save();
-
- // Hide label for comment field.
- entity_get_display('node', 'forum', 'default')
- ->setComponent('comment_forum', array(
- 'label' => 'hidden',
- 'type' => 'comment_default',
- 'weight' => 20,
- ))
- ->save();
- }
+ $term->save();
}
}
diff --git a/core/modules/node/config/install/field.storage.node.body.yml b/core/modules/node/config/install/field.storage.node.body.yml
new file mode 100644
index 0000000..fdf2b1f
--- /dev/null
+++ b/core/modules/node/config/install/field.storage.node.body.yml
@@ -0,0 +1,16 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ - text
+id: node.body
+name: body
+entity_type: node
+type: text_with_summary
+settings: { }
+module: text
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php
index 57fc6f6..e282246 100644
--- a/core/modules/node/src/Entity/NodeType.php
+++ b/core/modules/node/src/Entity/NodeType.php
@@ -84,28 +84,6 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
public $title_label = 'Title';
/**
- * Indicates whether a Body field should be created for this node type.
- *
- * This property affects entity creation only. It allows default configuration
- * of modules and installation profiles to specify whether a Body field should
- * be created for this bundle.
- *
- * @var bool
- *
- * @see \Drupal\node\Entity\NodeType::$create_body_label
- */
- protected $create_body = TRUE;
-
- /**
- * The label to use for the Body field upon entity creation.
- *
- * @see \Drupal\node\Entity\NodeType::$create_body
- *
- * @var string
- */
- protected $create_body_label = 'Body';
-
- /**
* Module-specific settings for this node type, keyed by module name.
*
* @var array
@@ -145,15 +123,7 @@ public function isLocked() {
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
- if (!$update) {
- // Create a body if the create_body property is true and we're not in
- // the syncing process.
- if ($this->get('create_body') && !$this->isSyncing()) {
- $label = $this->get('create_body_label');
- node_add_body_field($this, $label);
- }
- }
- elseif ($this->getOriginalId() != $this->id()) {
+ if ($this->getOriginalId() != $this->id()) {
$update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
if ($update_count) {
drupal_set_message(format_plural($update_count,
diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php
index c99045f..760eea5 100644
--- a/core/modules/node/src/NodeTypeForm.php
+++ b/core/modules/node/src/NodeTypeForm.php
@@ -192,6 +192,7 @@ public function save(array $form, FormStateInterface $form_state) {
drupal_set_message(t('The content type %name has been added.', $t_args));
$context = array_merge($t_args, array('link' => l(t('View'), 'admin/structure/types')));
$this->logger('node')->notice('Added content type %name.', $context);
+ node_add_body_field($type, 'Body');
}
$form_state->setRedirect('node.overview_types');
diff --git a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
index ca6e476..864cb18 100644
--- a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
+++ b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
@@ -39,11 +39,10 @@ public function setUp() {
* Tests configuration renaming.
*/
public function testConfigurationRename() {
- $content_type = entity_create('node_type', array(
+ $content_type = $this->drupalCreateContentType(array(
'type' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(),
));
- $content_type->save();
$staged_type = $content_type->type;
$active = $this->container->get('config.storage');
$staging = $this->container->get('config.storage.staging');
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 89ff9db..39dd33a 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -307,6 +307,8 @@ protected function drupalCreateContentType(array $values = array()) {
);
$type = entity_create('node_type', $values);
$status = $type->save();
+ // Add the body field as the form does.
+ node_add_body_field($type, 'Body');
\Drupal::service('router.builder')->rebuild();
$this->assertEqual($status, SAVED_NEW, String::format('Created content type %type.', array('%type' => $type->id())));
diff --git a/core/profiles/standard/config/install/entity.form_display.node.page.default.yml b/core/profiles/standard/config/install/entity.form_display.node.page.default.yml
new file mode 100644
index 0000000..0b19637
--- /dev/null
+++ b/core/profiles/standard/config/install/entity.form_display.node.page.default.yml
@@ -0,0 +1,35 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.page.body
+ - node.type.page
+ module:
+ - path
+ - text
+id: node.page.default
+targetEntityType: node
+bundle: page
+mode: default
+content:
+ title:
+ type: string
+ weight: -5
+ settings:
+ size: 60
+ placeholder: ''
+ third_party_settings: { }
+ path:
+ type: path
+ weight: 30
+ settings: { }
+ third_party_settings: { }
+ body:
+ type: text_textarea_with_summary
+ weight: 31
+ settings:
+ rows: 9
+ summary_rows: 3
+ placeholder: ''
+ third_party_settings: { }
+hidden: { }
diff --git a/core/profiles/standard/config/install/entity.view_display.node.page.default.yml b/core/profiles/standard/config/install/entity.view_display.node.page.default.yml
new file mode 100644
index 0000000..467a458
--- /dev/null
+++ b/core/profiles/standard/config/install/entity.view_display.node.page.default.yml
@@ -0,0 +1,22 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.instance.node.page.body
+ - node.type.page
+ module:
+ - text
+id: node.page.default
+label: null
+targetEntityType: node
+bundle: page
+mode: default
+content:
+ body:
+ label: hidden
+ type: text_default
+ weight: -4
+ settings: { }
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/core/profiles/standard/config/install/entity.view_display.node.page.teaser.yml b/core/profiles/standard/config/install/entity.view_display.node.page.teaser.yml
new file mode 100644
index 0000000..3955067
--- /dev/null
+++ b/core/profiles/standard/config/install/entity.view_display.node.page.teaser.yml
@@ -0,0 +1,24 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - entity.view_mode.node.teaser
+ - field.instance.node.page.body
+ - node.type.page
+ module:
+ - text
+id: node.page.teaser
+label: null
+targetEntityType: node
+bundle: page
+mode: teaser
+content:
+ body:
+ label: hidden
+ type: text_summary_or_trimmed
+ weight: -4
+ settings:
+ trim_length: 600
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/core/profiles/standard/config/install/field.instance.node.article.body.yml b/core/profiles/standard/config/install/field.instance.node.article.body.yml
new file mode 100644
index 0000000..2a2c69c
--- /dev/null
+++ b/core/profiles/standard/config/install/field.instance.node.article.body.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.body
+ - node.type.article
+id: node.article.body
+label: Body
+field_name: body
+entity_type: node
+bundle: article
+description: ''
+required: false
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ display_summary: true
+ text_processing: true
+field_type: text_with_summary
diff --git a/core/profiles/standard/config/install/field.instance.node.page.body.yml b/core/profiles/standard/config/install/field.instance.node.page.body.yml
new file mode 100644
index 0000000..4b806c0
--- /dev/null
+++ b/core/profiles/standard/config/install/field.instance.node.page.body.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ entity:
+ - field.storage.node.body
+ - node.type.page
+id: node.page.body
+label: Body
+field_name: body
+entity_type: node
+bundle: page
+description: ''
+required: false
+translatable: true
+default_value: { }
+default_value_function: ''
+settings:
+ display_summary: true
+ text_processing: true
+field_type: text_with_summary