diff --git a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
index cd7031e..acd1398 100644
--- a/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
+++ b/core/modules/comment/src/Tests/Views/DefaultViewRecentCommentsTest.php
@@ -68,10 +68,10 @@ protected function setUp() {
// Add a node of the new content type.
$node_data = array(
- 'type' => $content_type->type,
+ 'type' => $content_type->id(),
);
- $this->container->get('comment.manager')->addDefaultField('node', $content_type->type);
+ $this->container->get('comment.manager')->addDefaultField('node', $content_type->id());
$this->node = $this->drupalCreateNode($node_data);
// Force a flush of the in-memory storage.
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index a44d189..9468b36 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -110,18 +110,18 @@ public function testExportImport() {
$this->fieldStorage->save();
entity_create('field_config', array(
'field_storage' => $this->fieldStorage,
- 'bundle' => $this->contentType->type,
+ 'bundle' => $this->contentType->id(),
))->save();
- entity_get_form_display('node', $this->contentType->type, 'default')
+ entity_get_form_display('node', $this->contentType->id(), 'default')
->setComponent($this->fieldName, array(
'type' => 'text_textfield',
))
->save();
- entity_get_display('node', $this->contentType->type, 'full')
+ entity_get_display('node', $this->contentType->id(), 'full')
->setComponent($this->fieldName)
->save();
- $this->drupalGet('node/add/' . $this->contentType->type);
+ $this->drupalGet('node/add/' . $this->contentType->id());
$this->assertFieldByName("{$this->fieldName}[0][value]", '', 'Widget is displayed');
// Export the configuration.
@@ -146,7 +146,7 @@ public function testExportImport() {
$field_storage->delete();
}
}
- $this->drupalGet('node/add/' . $this->contentType->type);
+ $this->drupalGet('node/add/' . $this->contentType->id());
$this->assertNoFieldByName("{$this->fieldName}[0][value]", '', 'Widget is not displayed');
// Import the configuration.
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
index a13a75b..3bda429 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
@@ -48,7 +48,7 @@ protected function setUp() {
// Create a content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
- $this->type = $type->type;
+ $this->type = $type->id();
}
/**
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
index ea4d37f..dc87dc8 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
@@ -39,10 +39,10 @@ protected function setUp() {
// Create "referencing" and "referenced" node types.
$referencing = $this->drupalCreateContentType();
- $this->referencingType = $referencing->type;
+ $this->referencingType = $referencing->id();
$referenced = $this->drupalCreateContentType();
- $this->referencedType = $referenced->type;
+ $this->referencedType = $referenced->id();
entity_create('field_storage_config', array(
'field_name' => 'test_field',
@@ -60,13 +60,13 @@ protected function setUp() {
'label' => 'Entity reference field',
'field_name' => 'test_field',
'entity_type' => 'node',
- 'bundle' => $referencing->type,
+ 'bundle' => $referencing->id(),
'settings' => array(
'handler' => 'default',
'handler_settings' => array(
// Reference a single vocabulary.
'target_bundles' => array(
- $referenced->type,
+ $referenced->id(),
),
// Enable auto-create.
'auto_create' => TRUE,
@@ -74,10 +74,10 @@ protected function setUp() {
),
))->save();
- entity_get_display('node', $referencing->type, 'default')
+ entity_get_display('node', $referencing->id(), 'default')
->setComponent('test_field')
->save();
- entity_get_form_display('node', $referencing->type, 'default')
+ entity_get_form_display('node', $referencing->id(), 'default')
->setComponent('test_field', array(
'type' => 'entity_reference_autocomplete',
))
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php
index 8480073..a1d7102 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php
@@ -194,7 +194,7 @@ protected function setUpEntityReferenceField() {
entity_create('field_config', array(
'field_name' => $this->referenceFieldName,
- 'bundle' => $this->referrerType->type,
+ 'bundle' => $this->referrerType->id(),
'entity_type' => $this->testEntityTypeName,
))
->save();
diff --git a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php b/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
index 823e46f..60d6f04 100644
--- a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
+++ b/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
@@ -23,7 +23,7 @@ class SelectionTest extends WebTestBase {
*/
public function testSelectionHandler() {
// Create nodes.
- $type = $this->drupalCreateContentType()->type;
+ $type = $this->drupalCreateContentType()->id();
$node1 = $this->drupalCreateNode(array('type' => $type));
$node2 = $this->drupalCreateNode(array('type' => $type));
$node3 = $this->drupalCreateNode();
diff --git a/core/modules/field/src/Tests/FieldAccessTest.php b/core/modules/field/src/Tests/FieldAccessTest.php
index b4f0b5a..4b067a8 100644
--- a/core/modules/field/src/Tests/FieldAccessTest.php
+++ b/core/modules/field/src/Tests/FieldAccessTest.php
@@ -43,7 +43,7 @@ protected function setUp() {
// Create content type.
$content_type_info = $this->drupalCreateContentType();
- $content_type = $content_type_info->type;
+ $content_type = $content_type_info->id();
$field_storage = array(
'field_name' => 'test_view_field',
diff --git a/core/modules/field_ui/src/Tests/EntityDisplayTest.php b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
index 0db126a..099bc7f 100644
--- a/core/modules/field_ui/src/Tests/EntityDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
@@ -280,7 +280,7 @@ public function testRenameDeleteBundle() {
// Rename the article bundle and assert the entity display is renamed.
$type->old_type = 'article';
- $type->type = 'article_rename';
+ $type->set('type', 'article_rename');
$type->save();
$old_display = entity_load('entity_view_display', 'node.article.default');
$this->assertFalse((bool) $old_display);
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index e628757..2eb89be 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
// Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
- $this->type = $type->type;
+ $this->type = $type->id();
// Create a default vocabulary.
$vocabulary = entity_create('taxonomy_vocabulary', array(
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index 2a1161c..472d59c 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -43,7 +43,7 @@ protected function setUp() {
// Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
- $this->type = $type->type;
+ $this->type = $type->id();
// Create random field name.
$this->field_label = $this->randomMachineName(8);
@@ -400,7 +400,7 @@ function testDeleteField() {
// Create an additional node type.
$type_name2 = strtolower($this->randomMachineName(8)) . '_test';
$type2 = $this->drupalCreateContentType(array('name' => $type_name2, 'type' => $type_name2));
- $type_name2 = $type2->type;
+ $type_name2 = $type2->id();
// Add a field to the second node type.
$bundle_path2 = 'admin/structure/types/manage/' . $type_name2;
diff --git a/core/modules/filter/src/Tests/FilterHooksTest.php b/core/modules/filter/src/Tests/FilterHooksTest.php
index 4b91a31..60951e4 100644
--- a/core/modules/filter/src/Tests/FilterHooksTest.php
+++ b/core/modules/filter/src/Tests/FilterHooksTest.php
@@ -64,7 +64,7 @@ function testFilterHooks() {
$edit['title[0][value]'] = $title;
$edit['body[0][value]'] = $this->randomMachineName(32);
$edit['body[0][format]'] = $format_id;
- $this->drupalPostForm("node/add/{$type->type}", $edit, t('Save and publish'));
+ $this->drupalPostForm("node/add/{$type->id()}", $edit, t('Save and publish'));
$this->assertText(t('@type @title has been created.', array('@type' => $type_name, '@title' => $title)));
// Disable the text format.
diff --git a/core/modules/link/src/Tests/LinkFieldUITest.php b/core/modules/link/src/Tests/LinkFieldUITest.php
index fd56518..3428faa 100644
--- a/core/modules/link/src/Tests/LinkFieldUITest.php
+++ b/core/modules/link/src/Tests/LinkFieldUITest.php
@@ -39,7 +39,7 @@ protected function setUp() {
function testFieldUI() {
// Add a content type.
$type = $this->drupalCreateContentType();
- $type_path = 'admin/structure/types/manage/' . $type->type;
+ $type_path = 'admin/structure/types/manage/' . $type->id();
// Add a link field to the newly-created type.
$label = $this->randomMachineName();
diff --git a/core/modules/locale/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php
index 4570d3c..2b66904 100644
--- a/core/modules/locale/src/Tests/LocaleContentTest.php
+++ b/core/modules/locale/src/Tests/LocaleContentTest.php
@@ -64,7 +64,7 @@ public function testContentTypeLanguageConfiguration() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// User to create a node.
- $web_user = $this->drupalCreateUser(array("create {$type1->type} content", "create {$type2->type} content", "edit any {$type2->type} content"));
+ $web_user = $this->drupalCreateUser(array("create {$type1->id()} content", "create {$type2->id()} content", "edit any {$type2->id()} content"));
// Add custom language.
$this->drupalLogin($admin_user);
@@ -81,24 +81,24 @@ public function testContentTypeLanguageConfiguration() {
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Set the content type to use multilingual support.
- $this->drupalGet("admin/structure/types/manage/{$type2->type}");
+ $this->drupalGet("admin/structure/types/manage/{$type2->id()}");
$this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
- $this->drupalPostForm("admin/structure/types/manage/{$type2->type}", $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name)));
+ $this->drupalPostForm("admin/structure/types/manage/{$type2->id()}", $edit, t('Save content type'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->label())));
$this->drupalLogout();
\Drupal::languageManager()->reset();
// Verify language selection is not present on the node add form.
$this->drupalLogin($web_user);
- $this->drupalGet("node/add/{$type1->type}");
+ $this->drupalGet("node/add/{$type1->id()}");
// Verify language select list is not present.
$this->assertNoFieldByName('langcode[0][value]', NULL, 'Language select not present on the node add form.');
// Verify language selection appears on the node add form.
- $this->drupalGet("node/add/{$type2->type}");
+ $this->drupalGet("node/add/{$type2->id()}");
// Verify language select list is present.
$this->assertFieldByName('langcode[0][value]', NULL, 'Language select present on the node add form.');
// Ensure language appears.
@@ -108,7 +108,7 @@ public function testContentTypeLanguageConfiguration() {
$node_title = $this->randomMachineName();
$node_body = $this->randomMachineName();
$edit = array(
- 'type' => $type2->type,
+ 'type' => $type2->id(),
'title' => $node_title,
'body' => array(array('value' => $node_body)),
'langcode' => $langcode,
@@ -137,7 +137,7 @@ public function testContentTypeDirLang() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// User to create a node.
- $web_user = $this->drupalCreateUser(array("create {$type->type} content", "edit own {$type->type} content"));
+ $web_user = $this->drupalCreateUser(array("create {$type->id()} content", "edit own {$type->id()} content"));
// Login as admin.
$this->drupalLogin($admin_user);
@@ -154,12 +154,12 @@ public function testContentTypeDirLang() {
\Drupal::languageManager()->reset();
// Set the content type to use multilingual support.
- $this->drupalGet("admin/structure/types/manage/{$type->type}");
+ $this->drupalGet("admin/structure/types/manage/{$type->id()}");
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
- $this->drupalPostForm("admin/structure/types/manage/{$type->type}", $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->name)));
+ $this->drupalPostForm("admin/structure/types/manage/{$type->id()}", $edit, t('Save content type'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->label())));
$this->drupalLogout();
// Login as web user to add new node.
@@ -170,7 +170,7 @@ public function testContentTypeDirLang() {
foreach (array('en', 'es', 'ar') as $langcode) {
$nodes[$langcode] = $this->drupalCreateNode(array(
'langcode' => $langcode,
- 'type' => $type->type,
+ 'type' => $type->id(),
'promote' => NODE_PROMOTED,
));
}
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 84a2d19..ee12d9a 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -117,11 +117,13 @@ function node_help($route_name, RouteMatchInterface $route_match) {
case 'entity.node.edit_form':
$node = $route_match->getParameter('node');
$type = NodeType::load($node->getType());
- return (!empty($type->help) ? Xss::filterAdmin($type->help) : '');
+ $help = $type->getHelp();
+ return (!empty($help) ? Xss::filterAdmin($help) : '');
case 'node.add':
$type = $route_match->getParameter('node_type');
- return (!empty($type->help) ? Xss::filterAdmin($type->help) : '');
+ $help = $type->getHelp();
+ return (!empty($help) ? Xss::filterAdmin($help) : '');
}
}
@@ -286,7 +288,7 @@ function node_get_type_label(NodeInterface $node) {
* The node type description.
*/
function node_type_get_description(NodeTypeInterface $node_type) {
- return $node_type->description;
+ return $node_type->getDescription();
}
/**
@@ -329,14 +331,14 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') {
$field->save();
// Assign widget settings for the 'default' form mode.
- entity_get_form_display('node', $type->type, 'default')
+ entity_get_form_display('node', $type->id(), 'default')
->setComponent('body', array(
'type' => 'text_textarea_with_summary',
))
->save();
// Assign display settings for the 'default' and 'teaser' view modes.
- entity_get_display('node', $type->type, 'default')
+ entity_get_display('node', $type->id(), 'default')
->setComponent('body', array(
'label' => 'hidden',
'type' => 'text_default',
@@ -347,7 +349,7 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') {
// might not exist.
$view_modes = \Drupal::entityManager()->getViewModes('node');
if (isset($view_modes['teaser'])) {
- entity_get_display('node', $type->type, 'teaser')
+ entity_get_display('node', $type->id(), 'teaser')
->setComponent('body', array(
'label' => 'hidden',
'type' => 'text_summary_or_trimmed',
@@ -366,7 +368,7 @@ function node_entity_extra_field_info() {
$extra = array();
$description = t('Node module element');
foreach (node_type_get_types() as $bundle) {
- $extra['node'][$bundle->type]['display']['links'] = array(
+ $extra['node'][$bundle->id()]['display']['links'] = array(
'label' => t('Links'),
'description' => $description,
'weight' => 100,
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index 112e9c2..3c788ae 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -30,10 +30,10 @@ function template_preprocess_node_add_list(&$variables) {
$variables['types'] = array();
if (!empty($variables['content'])) {
foreach ($variables['content'] as $type) {
- $variables['types'][$type->type] = array(
- 'type' => $type->type,
- 'add_link' => \Drupal::l($type->name, new Url('node.add', array('node_type' => $type->type))),
- 'description' => Xss::filterAdmin($type->description),
+ $variables['types'][$type->id()] = array(
+ 'type' => $type->id(),
+ 'add_link' => \Drupal::l($type->label(), new Url('node.add', array('node_type' => $type->id()))),
+ 'description' => Xss::filterAdmin($type->getDescription()),
);
}
}
diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php
index 6ee2017..f4a30ee 100644
--- a/core/modules/node/src/Controller/NodeController.php
+++ b/core/modules/node/src/Controller/NodeController.php
@@ -79,15 +79,15 @@ public function addPage() {
// Only use node types the user has access to.
foreach ($this->entityManager()->getStorage('node_type')->loadMultiple() as $type) {
- if ($this->entityManager()->getAccessControlHandler('node')->createAccess($type->type)) {
- $content[$type->type] = $type;
+ if ($this->entityManager()->getAccessControlHandler('node')->createAccess($type->id())) {
+ $content[$type->id()] = $type;
}
}
// Bypass the node/add listing if only one content type is available.
if (count($content) == 1) {
$type = array_shift($content);
- return $this->redirect('node.add', array('node_type' => $type->type));
+ return $this->redirect('node.add', array('node_type' => $type->id()));
}
return array(
@@ -107,7 +107,7 @@ public function addPage() {
*/
public function add(NodeTypeInterface $node_type) {
$node = $this->entityManager()->getStorage('node')->create(array(
- 'type' => $node_type->type,
+ 'type' => $node_type->id(),
));
$form = $this->entityFormBuilder()->getForm($node);
@@ -243,7 +243,7 @@ public function revisionOverview(NodeInterface $node) {
* The page title.
*/
public function addPageTitle(NodeTypeInterface $node_type) {
- return $this->t('Create @name', array('@name' => $node_type->name));
+ return $this->t('Create @name', array('@name' => $node_type->label()));
}
}
diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php
index 6113247..886be88 100644
--- a/core/modules/node/src/Entity/NodeType.php
+++ b/core/modules/node/src/Entity/NodeType.php
@@ -50,7 +50,7 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
*
* @todo Rename to $id.
*/
- public $type;
+ protected $type;
/**
* The human-readable name of the node type.
@@ -59,21 +59,21 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
*
* @todo Rename to $label.
*/
- public $name;
+ protected $name;
/**
* A brief description of this node type.
*
* @var string
*/
- public $description;
+ protected $description;
/**
* Help information shown to the user when creating a Node of this type.
*
* @var string
*/
- public $help;
+ protected $help;
/**
* Default value of the 'Create new revision' checkbox of this node type.
@@ -156,6 +156,20 @@ public function setPreviewMode($preview_mode) {
/**
* {@inheritdoc}
*/
+ public function getHelp() {
+ return $this->help;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDescription() {
+ return $this->description;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php
index 8a0f2a6..cbfe841 100644
--- a/core/modules/node/src/NodeTypeForm.php
+++ b/core/modules/node/src/NodeTypeForm.php
@@ -73,7 +73,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['name'] = array(
'#title' => t('Name'),
'#type' => 'textfield',
- '#default_value' => $type->name,
+ '#default_value' => $type->label(),
'#description' => t('The human-readable name of this content type. This text will be displayed as part of the list on the Add content page. This name must be unique.'),
'#required' => TRUE,
'#size' => 30,
@@ -96,7 +96,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#title' => t('Description'),
'#type' => 'textarea',
- '#default_value' => $type->description,
+ '#default_value' => $type->getDescription(),
'#description' => t('Describe this content type. The text will be displayed on the Add content page.'),
);
@@ -132,7 +132,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['submission']['help'] = array(
'#type' => 'textarea',
'#title' => t('Explanation or submission guidelines'),
- '#default_value' => $type->help,
+ '#default_value' => $type->getHelp(),
'#description' => t('This text will be displayed at the top of the page when creating or editing content of this type.'),
);
$form['workflow'] = array(
@@ -220,8 +220,8 @@ public function validate(array $form, FormStateInterface $form_state) {
public function save(array $form, FormStateInterface $form_state) {
$type = $this->entity;
$type->setNewRevision($form_state->getValue(array('options', 'revision')));
- $type->type = trim($type->id());
- $type->name = trim($type->name);
+ $type->set('type', trim($type->id()));
+ $type->set('name', trim($type->label()));
$status = $type->save();
diff --git a/core/modules/node/src/NodeTypeInterface.php b/core/modules/node/src/NodeTypeInterface.php
index d113f87..cd8e9f9 100644
--- a/core/modules/node/src/NodeTypeInterface.php
+++ b/core/modules/node/src/NodeTypeInterface.php
@@ -71,4 +71,19 @@ public function getPreviewMode();
*/
public function setPreviewMode($preview_mode);
+ /**
+ * Returns the help information.
+ *
+ * @return string
+ * The help information of this node type.
+ */
+ public function getHelp();
+
+ /**
+ * Returns the description.
+ *
+ * @return string
+ * The description of this node type.
+ */
+ public function getDescription();
}
diff --git a/core/modules/node/src/NodeTypeListBuilder.php b/core/modules/node/src/NodeTypeListBuilder.php
index 1ba9a62..494e217 100644
--- a/core/modules/node/src/NodeTypeListBuilder.php
+++ b/core/modules/node/src/NodeTypeListBuilder.php
@@ -76,7 +76,7 @@ public function buildRow(EntityInterface $entity) {
'data' => $this->getLabel($entity),
'class' => array('menu-label'),
);
- $row['description'] = Xss::filterAdmin($entity->description);
+ $row['description'] = Xss::filterAdmin($entity->getDescription());
return $row + parent::buildRow($entity);
}
diff --git a/core/modules/node/src/Plugin/Condition/NodeType.php b/core/modules/node/src/Plugin/Condition/NodeType.php
index 9a2b35b..77f9a3f 100644
--- a/core/modules/node/src/Plugin/Condition/NodeType.php
+++ b/core/modules/node/src/Plugin/Condition/NodeType.php
@@ -73,7 +73,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$options = array();
$node_types = $this->entityStorage->loadMultiple();
foreach ($node_types as $type) {
- $options[$type->type] = $type->name;
+ $options[$type->id()] = $type->label();
}
$form['bundles'] = array(
'#title' => $this->t('Node types'),
diff --git a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
index ba69214..ae35b0e 100644
--- a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
+++ b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
@@ -50,7 +50,7 @@ public function testConfigurationRename() {
'type' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(),
));
- $staged_type = $content_type->type;
+ $staged_type = $content_type->id();
// Check the default status value for a node of this type.
$node = entity_create('node', array('type' => $staged_type));
@@ -68,9 +68,9 @@ public function testConfigurationRename() {
$this->copyConfig($active, $staging);
// Change the machine name of the content type.
- $content_type->type = Unicode::strtolower($this->randomMachineName(8));
+ $content_type->set('type', Unicode::strtolower($this->randomMachineName(8)));
$content_type->save();
- $active_type = $content_type->type;
+ $active_type = $content_type->id();
// Ensure the base field override has been renamed and the value is correct.
$node = entity_create('node', array('type' => $active_type));
@@ -134,7 +134,7 @@ public function testConfigurationRename() {
$this->assertFalse(entity_load('node_type', $active_type), 'The content no longer exists with the old name.');
$content_type = entity_load('node_type', $staged_type);
- $this->assertIdentical($staged_type, $content_type->type);
+ $this->assertIdentical($staged_type, $content_type->id());
// Ensure the base field override has been renamed and the value is correct.
$node = entity_create('node', array('type' => $staged_type));
diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php
index d0d5d54..63c8ba9 100644
--- a/core/modules/node/src/Tests/NodeTypeTest.php
+++ b/core/modules/node/src/Tests/NodeTypeTest.php
@@ -35,11 +35,11 @@ function testNodeTypeGetFunctions() {
$this->assertTrue(isset($node_types['article']), 'Node type article is available.');
$this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
- $this->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
+ $this->assertEqual($node_types['article']->label(), $node_names['article'], 'Correct node type base has been returned.');
$article = entity_load('node_type', 'article');
$this->assertEqual($node_types['article'], $article, 'Correct node type has been returned.');
- $this->assertEqual($node_types['article']->name, $article->label(), 'Correct node type name has been returned.');
+ $this->assertEqual($node_types['article']->label(), $article->label(), 'Correct node type name has been returned.');
}
/**
@@ -49,14 +49,14 @@ function testNodeTypeCreation() {
// Create a content type programmaticaly.
$type = $this->drupalCreateContentType();
- $type_exists = (bool) entity_load('node_type', $type->type);
+ $type_exists = (bool) entity_load('node_type', $type->id());
$this->assertTrue($type_exists, 'The new content type has been created in the database.');
// Login a test user.
- $web_user = $this->drupalCreateUser(array('create ' . $type->name . ' content'));
+ $web_user = $this->drupalCreateUser(array('create ' . $type->label() . ' content'));
$this->drupalLogin($web_user);
- $this->drupalGet('node/add/' . $type->type);
+ $this->drupalGet('node/add/' . $type->id());
$this->assertResponse(200, 'The new content type can be accessed at node/add.');
// Create a content type via the user interface.
@@ -137,11 +137,11 @@ function testNodeTypeDeletion() {
$this->drupalLogin($web_user);
// Add a new node of this type.
- $node = $this->drupalCreateNode(array('type' => $type->type));
+ $node = $this->drupalCreateNode(array('type' => $type->id()));
// Attempt to delete the content type, which should not be allowed.
- $this->drupalGet('admin/structure/types/manage/' . $type->name . '/delete');
+ $this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
$this->assertRaw(
- t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', array('%type' => $type->name)),
+ t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', array('%type' => $type->label())),
'The content type will not be deleted until all nodes of that type are removed.'
);
$this->assertNoText(t('This action cannot be undone.'), 'The node type deletion confirmation form is not available.');
@@ -149,9 +149,9 @@ function testNodeTypeDeletion() {
// Delete the node.
$node->delete();
// Attempt to delete the content type, which should now be allowed.
- $this->drupalGet('admin/structure/types/manage/' . $type->name . '/delete');
+ $this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
$this->assertRaw(
- t('Are you sure you want to delete the content type %type?', array('%type' => $type->name)),
+ t('Are you sure you want to delete the content type %type?', array('%type' => $type->label())),
'The content type is available for deletion.'
);
$this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.');
diff --git a/core/modules/node/src/Tests/Views/NodeIntegrationTest.php b/core/modules/node/src/Tests/Views/NodeIntegrationTest.php
index 2be15a0..b4188b7 100644
--- a/core/modules/node/src/Tests/Views/NodeIntegrationTest.php
+++ b/core/modules/node/src/Tests/Views/NodeIntegrationTest.php
@@ -34,8 +34,8 @@ public function testNodeViewTypeArgument() {
for ($j = 0; $j < 5; $j++) {
// Ensure the right order of the nodes.
- $node = $this->drupalCreateNode(array('type' => $type->type, 'created' => REQUEST_TIME - ($i * 5 + $j)));
- $nodes[$type->type][$node->id()] = $node;
+ $node = $this->drupalCreateNode(array('type' => $type->id(), 'created' => REQUEST_TIME - ($i * 5 + $j)));
+ $nodes[$type->id()][$node->id()] = $node;
$all_nids[] = $node->id();
}
}
@@ -48,8 +48,8 @@ public function testNodeViewTypeArgument() {
$this->assertNids($all_nids);
foreach ($types as $type) {
- $this->drupalGet("test-node-view/{$type->type}");
- $this->assertNids(array_keys($nodes[$type->type]));
+ $this->drupalGet("test-node-view/{$type->id()}");
+ $this->assertNids(array_keys($nodes[$type->id()]));
}
}
diff --git a/core/modules/options/src/Tests/OptionsFieldUITest.php b/core/modules/options/src/Tests/OptionsFieldUITest.php
index eeefe39..ef2b020 100644
--- a/core/modules/options/src/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/src/Tests/OptionsFieldUITest.php
@@ -62,7 +62,7 @@ protected function setUp() {
// Create content type, with underscores.
$this->typeName = 'test_' . strtolower($this->randomMachineName());
$type = $this->drupalCreateContentType(['name' => $this->typeName, 'type' => $this->typeName]);
- $this->type = $type->type;
+ $this->type = $type->id();
}
/**
diff --git a/core/modules/views/src/Tests/GlossaryTest.php b/core/modules/views/src/Tests/GlossaryTest.php
index 61fb6a3..8ae6592 100644
--- a/core/modules/views/src/Tests/GlossaryTest.php
+++ b/core/modules/views/src/Tests/GlossaryTest.php
@@ -40,7 +40,7 @@ public function testGlossaryView() {
);
foreach ($nodes_per_char as $char => $count) {
$setting = array(
- 'type' => $type->type
+ 'type' => $type->id()
);
for ($i = 0; $i < $count; $i++) {
$node = $setting;
diff --git a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php
index 9aedee2..bcccbdc 100644
--- a/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldGroupRowsTest.php
@@ -58,7 +58,7 @@ protected function setUp() {
// Create an instance of the text field on the content type.
$field = array(
'field_storage' => $field_storage,
- 'bundle' => $node_type->type,
+ 'bundle' => $node_type->id(),
);
entity_create('field_config', $field)->save();
diff --git a/core/modules/views/src/Tests/SearchIntegrationTest.php b/core/modules/views/src/Tests/SearchIntegrationTest.php
index 6a8ccba..7307ce1 100644
--- a/core/modules/views/src/Tests/SearchIntegrationTest.php
+++ b/core/modules/views/src/Tests/SearchIntegrationTest.php
@@ -39,7 +39,7 @@ public function testSearchIntegration() {
// with the word "sandwich". Make the second node link to the first.
$node['title'] = 'pizza';
$node['body'] = array(array('value' => 'pizza'));
- $node['type'] = $type->type;
+ $node['type'] = $type->id();
$this->drupalCreateNode($node);
$this->drupalGet('node/1');
diff --git a/core/modules/views/src/Tests/SearchMultilingualTest.php b/core/modules/views/src/Tests/SearchMultilingualTest.php
index 4750f0b..4a6d4c7 100644
--- a/core/modules/views/src/Tests/SearchMultilingualTest.php
+++ b/core/modules/views/src/Tests/SearchMultilingualTest.php
@@ -47,19 +47,19 @@ public function testMultilingualSearchFilter() {
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
- $this->drupalPostForm('admin/structure/types/manage/' . $type->type, $edit, t('Save content type'));
+ $this->drupalPostForm('admin/structure/types/manage/' . $type->id(), $edit, t('Save content type'));
$edit = array(
'entity_types[node]' => TRUE,
- 'settings[node][' . $type->type . '][translatable]' => TRUE,
- 'settings[node][' . $type->type . '][fields][title]' => TRUE,
- 'settings[node][' . $type->type . '][fields][body]' => TRUE,
+ 'settings[node][' . $type->id() . '][translatable]' => TRUE,
+ 'settings[node][' . $type->id() . '][fields][title]' => TRUE,
+ 'settings[node][' . $type->id() . '][fields][body]' => TRUE,
);
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
// Add a node in English, with title "sandwich".
$values = array(
'title' => 'sandwich',
- 'type' => $type->type,
+ 'type' => $type->id(),
);
$node = $this->drupalCreateNode($values);
diff --git a/core/modules/views/src/Tests/Wizard/TaggedWithTest.php b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
index 02e46bc..cf7f380 100644
--- a/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
@@ -70,23 +70,23 @@ protected function setUp() {
// configure it to display an autocomplete widget.
$this->tag_field = array(
'field_storage' => $this->tag_field_storage,
- 'bundle' => $this->node_type_with_tags->type,
+ 'bundle' => $this->node_type_with_tags->id(),
);
entity_create('field_config', $this->tag_field)->save();
- entity_get_form_display('node', $this->node_type_with_tags->type, 'default')
+ entity_get_form_display('node', $this->node_type_with_tags->id(), 'default')
->setComponent('field_views_testing_tags', array(
'type' => 'taxonomy_autocomplete',
))
->save();
- entity_get_display('node', $this->node_type_with_tags->type, 'default')
+ entity_get_display('node', $this->node_type_with_tags->id(), 'default')
->setComponent('field_views_testing_tags', array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
))
->save();
- entity_get_display('node', $this->node_type_with_tags->type, 'teaser')
+ entity_get_display('node', $this->node_type_with_tags->id(), 'teaser')
->setComponent('field_views_testing_tags', array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
@@ -100,7 +100,7 @@ protected function setUp() {
function testTaggedWith() {
// In this test we will only create nodes that have an instance of the tag
// field.
- $node_add_path = 'node/add/' . $this->node_type_with_tags->type;
+ $node_add_path = 'node/add/' . $this->node_type_with_tags->id();
// Create three nodes, with different tags.
$edit = array();
@@ -120,7 +120,7 @@ function testTaggedWith() {
$view1 = array();
// First select the node type and update the form so the correct tag field
// is used.
- $view1['show[type]'] = $this->node_type_with_tags->type;
+ $view1['show[type]'] = $this->node_type_with_tags->id();
$this->drupalPostForm('admin/structure/views/add', $view1, t('Update "of type" choice'));
// Now resubmit the entire form to the same URL.
$view1['label'] = $this->randomMachineName(16);
@@ -142,7 +142,7 @@ function testTaggedWith() {
// Create a view that filters by taxonomy term "tag2". It should show only
// the one node from above that is tagged with "tag2".
$view2 = array();
- $view2['show[type]'] = $this->node_type_with_tags->type;
+ $view2['show[type]'] = $this->node_type_with_tags->id();
$this->drupalPostForm('admin/structure/views/add', $view2, t('Update "of type" choice'));
$this->assertResponse(200);
$view2['label'] = $this->randomMachineName(16);
@@ -172,28 +172,28 @@ function testTaggedWithByNodeType() {
$tags_xpath = '//input[@name="show[tagged_with]"]';
$this->drupalGet('admin/structure/views/add');
$this->assertFieldByXpath($tags_xpath);
- $view['show[type]'] = $this->node_type_with_tags->type;
+ $view['show[type]'] = $this->node_type_with_tags->id();
$this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice'));
$this->assertFieldByXpath($tags_xpath);
- $view['show[type]'] = $this->node_type_without_tags->type;
+ $view['show[type]'] = $this->node_type_without_tags->id();
$this->drupalPostForm(NULL, $view, t('Update "of type" choice'));
$this->assertNoFieldByXpath($tags_xpath);
// If we add an instance of the tagging field to the second node type, the
// "tagged with" form element should not appear for it too.
$field = $this->tag_field;
- $field['bundle'] = $this->node_type_without_tags->type;
+ $field['bundle'] = $this->node_type_without_tags->id();
entity_create('field_config', $field)->save();
- entity_get_form_display('node', $this->node_type_without_tags->type, 'default')
+ entity_get_form_display('node', $this->node_type_without_tags->id(), 'default')
->setComponent('field_views_testing_tags', array(
'type' => 'taxonomy_autocomplete',
))
->save();
- $view['show[type]'] = $this->node_type_with_tags->type;
+ $view['show[type]'] = $this->node_type_with_tags->id();
$this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice'));
$this->assertFieldByXpath($tags_xpath);
- $view['show[type]'] = $this->node_type_without_tags->type;
+ $view['show[type]'] = $this->node_type_without_tags->id();
$this->drupalPostForm(NULL, $view, t('Update "of type" choice'));
$this->assertFieldByXpath($tags_xpath);
}