diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index d0edeef..bb21ac1 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -365,7 +365,10 @@ function testNonInitializedFields() { * Tests hiding the view modes fieldset when there's only one available. */ function testSingleViewMode() { - $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display'); + // Create a test field. + $this->fieldUIAddNewField('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview', 'test', 'test'); + + $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display'); $this->assertNoText('Use custom display settings for the following view modes', 'Custom display settings fieldset found.'); // This may not trigger a notice when 'view_modes_custom' isn't available. diff --git a/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml index dfca846..5542b66 100644 --- a/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml +++ b/core/modules/forum/config/install/core.entity_form_display.taxonomy_term.forums.default.yml @@ -17,10 +17,12 @@ content: size: 60 placeholder: '' third_party_settings: { } - description: - type: text_textfield + forum_description: + type: text_textarea weight: 0 - settings: { } + settings: + rows: 5 + placeholder: '' third_party_settings: { } hidden: { } third_party_settings: { } diff --git a/core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_description.yml b/core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_description.yml new file mode 100644 index 0000000..4ca9a47 --- /dev/null +++ b/core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_description.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.taxonomy_term.field_description + - taxonomy.vocabulary.forums + module: + - text +id: taxonomy_term.forums.forum_description +field_name: forum_description +entity_type: taxonomy_term +bundle: forums +label: Description +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +third_party_settings: { } +field_type: text_long diff --git a/core/modules/forum/config/install/field.storage.taxonomy_term.forum_description.yml b/core/modules/forum/config/install/field.storage.taxonomy_term.forum_description.yml new file mode 100644 index 0000000..07c8159 --- /dev/null +++ b/core/modules/forum/config/install/field.storage.taxonomy_term.forum_description.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - taxonomy + - text +id: taxonomy_term.forum_description +field_name: forum_description +entity_type: taxonomy_term +type: text_long +settings: { } +module: text +locked: true +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: true diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index 544a601..746cd7f 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -23,7 +23,6 @@ function forum_install() { // Create a default forum so forum posts can be created. $term = Term::create(array( 'name' => t('General discussion'), - 'description' => '', 'parent' => array(0), 'vid' => 'forums', 'forum_container' => 0, diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index d4be4f5..d3eb932 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -7,7 +7,6 @@ use Drupal\comment\CommentInterface; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; -use Drupal\Component\Utility\Xss; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Url; use Drupal\Component\Utility\String; @@ -567,7 +566,7 @@ function template_preprocess_forum_list(&$variables) { $row = 0; // Sanitize each forum so that the template can safely print the data. foreach ($variables['forums'] as $id => $forum) { - $variables['forums'][$id]->description = Xss::filterAdmin($forum->description->value); + $variables['forums'][$id]->description = $forum->forum_description->processed; $variables['forums'][$id]->link = $forum->url(); $variables['forums'][$id]->name = String::checkPlain($forum->label()); $variables['forums'][$id]->is_container = !empty($forum->forum_container->value); diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php index 2264ce0..b7bc6db 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -10,6 +10,8 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Link; use Drupal\simpletest\WebTestBase; +use Drupal\taxonomy\Entity\Term; +use Drupal\taxonomy\Entity\Vocabulary; /** * Create, view, edit, delete, and change forum entries and verify its @@ -47,17 +49,17 @@ class ForumTest extends WebTestBase { protected $web_user; /** - * An array representing a forum container. + * A taxonomy term representing a forum container. */ protected $forumContainer; /** - * An array representing a forum. + * A taxonomy term representing a forum. */ protected $forum; /** - * An array representing a root forum. + * A taxonomy term representing a root forum. */ protected $root_forum; @@ -120,7 +122,7 @@ function testForum() { // active forum topics list. $this->drupalLogin($this->web_user); // Verify that this user is shown a message that they may not post content. - $this->drupalGet('forum/' . $this->forum['tid']); + $this->drupalGet('forum/' . $this->forum->id()); $this->assertText(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect."); // Log in, and do basic tests for a user with permission to edit any forum @@ -140,7 +142,7 @@ function testForum() { // Verify that this user is shown a local task to add new forum content. $this->drupalGet('forum'); $this->assertLink(t('Add new Forum topic')); - $this->drupalGet('forum/' . $this->forum['tid']); + $this->drupalGet('forum/' . $this->forum->id()); $this->assertLink(t('Add new Forum topic')); // Login a user with permission to edit any forum content. @@ -152,7 +154,7 @@ function testForum() { $this->drupalGet('forum'); // Verify row for testing forum. - $forum_arg = array(':forum' => 'forum-list-' . $this->forum['tid']); + $forum_arg = array(':forum' => 'forum-list-' . $this->forum->id()); // Topics cell contains number of topics and number of unread topics. $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]', $forum_arg); @@ -161,13 +163,13 @@ function testForum() { $this->assertEqual($topics, '6', 'Number of topics found.'); // Verify the number of unread topics. - $unread_topics = $this->container->get('forum_manager')->unreadTopics($this->forum['tid'], $this->edit_any_topics_user->id()); + $unread_topics = $this->container->get('forum_manager')->unreadTopics($this->forum->id(), $this->edit_any_topics_user->id()); $unread_topics = format_plural($unread_topics, '1 new post', '@count new posts'); $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg); $this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.'); // Verify that the forum name is in the unread topics text. $xpath = $this->buildXPathQuery('//tr[@id=:forum]//em[@class="placeholder"]', $forum_arg); - $this->assertFieldByXpath($xpath, $this->forum['name'], 'Forum name found in unread topics text.'); + $this->assertFieldByXpath($xpath, $this->forum->label(), 'Forum name found in unread topics text.'); // Verify total number of posts in forum. $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="posts"]', $forum_arg); @@ -189,14 +191,14 @@ function testForum() { // Test editing a forum topic that has a comment. $this->drupalLogin($this->edit_any_topics_user); - $this->drupalGet('forum/' . $this->forum['tid']); + $this->drupalGet('forum/' . $this->forum->id()); $this->drupalPostForm('node/' . $node->id() . '/edit', array(), t('Save')); $this->assertResponse(200); // Test the root forum page title change. $this->drupalGet('forum'); $this->assertTitle(t('Forums | Drupal')); - $vocabulary = entity_load('taxonomy_vocabulary', $this->forum['vid']); + $vocabulary = Vocabulary::load($this->forum->getVocabularyId()); $vocabulary->set('name', 'Discussions'); $vocabulary->save(); $this->drupalGet('forum'); @@ -204,7 +206,7 @@ function testForum() { // Test anonymous action link. $this->drupalLogout(); - $this->drupalGet('forum/' . $this->forum['tid']); + $this->drupalGet('forum/' . $this->forum->id()); $this->assertLink(t('Log in to post new content in the forum.')); } @@ -266,7 +268,7 @@ private function doAdminTests($user) { $this->clickLink('edit container'); $this->assertRaw('Edit container', 'Followed the link to edit the container'); // Create forum inside the forum container. - $this->forum = $this->createForum('forum', $this->forumContainer['tid']); + $this->forum = $this->createForum('forum', $this->forumContainer->id()); // Verify the "edit forum" link exists and functions correctly. $this->drupalGet('admin/structure/forum'); $this->clickLink('edit forum'); @@ -274,12 +276,12 @@ private function doAdminTests($user) { // Navigate back to forum structure page. $this->drupalGet('admin/structure/forum'); // Create second forum in container. - $this->delete_forum = $this->createForum('forum', $this->forumContainer['tid']); + $this->delete_forum = $this->createForum('forum', $this->forumContainer->id()); // Save forum overview. $this->drupalPostForm('admin/structure/forum/', array(), t('Save')); $this->assertRaw(t('The configuration options have been saved.')); // Delete this second forum. - $this->deleteForum($this->delete_forum['tid']); + $this->deleteForum($this->delete_forum->id()); // Create forum at the top (root) level. $this->root_forum = $this->createForum('forum'); @@ -289,7 +291,7 @@ private function doAdminTests($user) { $this->assertNoFieldByName('op', t('Delete'), 'Delete button not found.'); // Test term edit form alterations. - $this->drupalGet('taxonomy/term/' . $this->forumContainer['tid'] . '/edit'); + $this->drupalGet('taxonomy/term/' . $this->forumContainer->id() . '/edit'); // Test parent field been hidden by forum module. $this->assertNoField('parent[]', 'Parent field not found.'); @@ -369,7 +371,7 @@ function createForum($type, $parent = 0) { $edit = array( 'name[0][value]' => $name, - 'description[0][value]' => $description, + 'forum_description[0][value]' => $description, 'parent[0]' => $parent, 'weight' => '0', ); @@ -387,11 +389,17 @@ function createForum($type, $parent = 0) { ); // Verify forum. - $term = db_query("SELECT * FROM {taxonomy_term_field_data} t WHERE t.vid = :vid AND t.name = :name AND t.description__value = :desc AND t.default_langcode = 1", array(':vid' => \Drupal::config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc(); - $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database'); + $tids = \Drupal::service('entity.query')->get('taxonomy_term') + ->condition('vid', \Drupal::config('forum.settings')->get('vocabulary')) + ->condition('name', $name) + ->condition('default_langcode', 1) + ->condition('forum_description', $description) + ->execute(); + $tid = reset($tids); + $this->assertTrue(!empty($tid), 'The ' . $type . ' exists in the database'); // Verify forum hierarchy. - $tid = $term['tid']; + $term = Term::load($tid); $parent_tid = db_query("SELECT t.parent FROM {taxonomy_term_hierarchy} t WHERE t.tid = :tid", array(':tid' => $tid))->fetchField(); $this->assertTrue($parent == $parent_tid, 'The ' . $type . ' is linked to its container'); @@ -469,7 +477,7 @@ function testForumWithNewPost() { // Login as the first user. $this->drupalLogin($this->admin_user); // Check that forum renders properly. - $this->drupalGet("forum/{$this->forum['tid']}"); + $this->drupalGet("forum/{$this->forum->id()}"); $this->assertResponse(200); } @@ -493,7 +501,7 @@ function createForumTopic($forum, $container = FALSE) { 'title[0][value]' => $title, 'body[0][value]' => $body, ); - $tid = $forum['tid']; + $tid = $forum->id(); // Create the forum topic, preselecting the forum ID via a URL parameter. $this->drupalPostForm('node/add/forum', $edit, t('Save'), array('query' => array('forum_id' => $tid))); @@ -501,12 +509,12 @@ function createForumTopic($forum, $container = FALSE) { $type = t('Forum topic'); if ($container) { $this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was not created'); - $this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'Error message was shown'); + $this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum->label())), 'Error message was shown'); return; } else { $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created'); - $this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'No error message was shown'); + $this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum->label())), 'No error message was shown'); } // Retrieve node object, ensure that the topic was created and in the proper forum. @@ -557,8 +565,8 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { $breadcrumb_build = array( Link::createFromRoute(t('Home'), ''), Link::createFromRoute(t('Forums'), 'forum.index'), - Link::createFromRoute($this->forumContainer['name'], 'forum.page', array('taxonomy_term' => $this->forumContainer['tid'])), - Link::createFromRoute($this->forum['name'], 'forum.page', array('taxonomy_term' => $this->forum['tid'])), + Link::createFromRoute($this->forumContainer->label(), 'forum.page', array('taxonomy_term' => $this->forumContainer->id())), + Link::createFromRoute($this->forum->label(), 'forum.page', array('taxonomy_term' => $this->forum->id())), ); $breadcrumb = array( '#theme' => 'breadcrumb', @@ -579,7 +587,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { $edit['title[0][value]'] = 'node/' . $node->id(); $edit['body[0][value]'] = $this->randomMachineName(256); // Assume the topic is initially associated with $forum. - $edit['taxonomy_forums'] = $this->root_forum['tid']; + $edit['taxonomy_forums'] = $this->root_forum->id(); $edit['shadow'] = TRUE; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title[0][value]'])), 'Forum node was edited'); @@ -589,7 +597,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { ':nid' => $node->id(), ':vid' => $node->getRevisionId(), ))->fetchField(); - $this->assertTrue($forum_tid == $this->root_forum['tid'], 'The forum topic is linked to a different forum'); + $this->assertTrue($forum_tid == $this->root_forum->id(), 'The forum topic is linked to a different forum'); // Delete forum node. $this->drupalPostForm('node/' . $node->id() . '/delete', array(), t('Delete')); @@ -608,16 +616,16 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { */ private function verifyForumView($forum, $parent = NULL) { // View forum page. - $this->drupalGet('forum/' . $forum['tid']); + $this->drupalGet('forum/' . $forum->id()); $this->assertResponse(200); - $this->assertTitle($forum['name'] . ' | Drupal'); + $this->assertTitle($forum->label() . ' | Drupal'); $breadcrumb_build = array( Link::createFromRoute(t('Home'), ''), Link::createFromRoute(t('Forums'), 'forum.index'), ); if (isset($parent)) { - $breadcrumb_build[] = Link::createFromRoute($parent['name'], 'forum.page', array('taxonomy_term' => $parent['tid'])); + $breadcrumb_build[] = Link::createFromRoute($parent->label(), 'forum.page', array('taxonomy_term' => $parent->id())); } $breadcrumb = array( diff --git a/core/modules/forum/templates/forum-list.html.twig b/core/modules/forum/templates/forum-list.html.twig index 5b41f6a..4135e26 100644 --- a/core/modules/forum/templates/forum-list.html.twig +++ b/core/modules/forum/templates/forum-list.html.twig @@ -15,8 +15,7 @@ * - icon_title: Text alternative for the forum icon. * - name: The name of the forum. * - link: The URL to link to this forum. - * - description: The description field for the forum, containing: - * - value: The descriptive text for the forum. + * - description: The description of the forum. * - new_topics: A flag indicating if the forum contains unread posts. * - new_url: A URL to the forum's unread posts. * - new_text: Text for the above URL, which tells how many new posts. @@ -59,8 +58,8 @@ {{ forum.icon_title }} - {% if forum.description.value %} -
{{ forum.description.value }}
+ {% if forum.description %} +
{{ forum.description }}
{% endif %} {% for i in 1..forum.depth if forum.depth > 0 %}{% endfor %} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php index d2eb969..cc75fab 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php @@ -89,7 +89,6 @@ public function testTaxonomyTerms() { /** @var Term $term */ $term = $terms[$tid]; $this->assertIdentical($term->name->value, "term {$tid} of vocabulary {$values['source_vid']}"); - $this->assertIdentical($term->description->value, "description of term {$tid} of vocabulary {$values['source_vid']}"); $this->assertEqual($term->vid->target_id, $values['vid']); $this->assertEqual($term->weight->value, $values['weight']); if ($values['parent'] === array(0)) { diff --git a/core/modules/path/src/Tests/PathTaxonomyTermTest.php b/core/modules/path/src/Tests/PathTaxonomyTermTest.php index 895fac6..3706f6a 100644 --- a/core/modules/path/src/Tests/PathTaxonomyTermTest.php +++ b/core/modules/path/src/Tests/PathTaxonomyTermTest.php @@ -42,10 +42,8 @@ protected function setUp() { function testTermAlias() { // Create a term in the default 'Tags' vocabulary with URL alias. $vocabulary = entity_load('taxonomy_vocabulary', 'tags'); - $description = $this->randomMachineName(); $edit = array( 'name[0][value]' => $this->randomMachineName(), - 'description[0][value]' => $description, 'path[0][alias]' => $this->randomMachineName(), ); $this->drupalPostForm('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add', $edit, t('Save')); @@ -53,7 +51,7 @@ function testTermAlias() { // Confirm that the alias works. $this->drupalGet($edit['path[0][alias]']); - $this->assertText($description, 'Term can be accessed on URL alias.'); + $this->assertText($edit['name[0][value]'], 'Term can be accessed on URL alias.'); // Confirm the 'canonical' and 'shortlink' URLs. $elements = $this->xpath("//link[contains(@rel, 'canonical') and contains(@href, '" . $edit['path[0][alias]'] . "')]"); @@ -68,11 +66,11 @@ function testTermAlias() { // Confirm that the changed alias works. $this->drupalGet($edit2['path[0][alias]']); - $this->assertText($description, 'Term can be accessed on changed URL alias.'); + $this->assertText($edit['name[0][value]'], 'Term can be accessed on changed URL alias.'); // Confirm that the old alias no longer works. $this->drupalGet($edit['path[0][alias]']); - $this->assertNoText($description, 'Old URL alias has been removed after altering.'); + $this->assertNoText($edit['name[0][value]'], 'Old URL alias has been removed after altering.'); $this->assertResponse(404, 'Old URL alias returns 404.'); // Remove the term's URL alias. @@ -82,7 +80,7 @@ function testTermAlias() { // Confirm that the alias no longer works. $this->drupalGet($edit2['path[0][alias]']); - $this->assertNoText($description, 'Old URL alias has been removed after altering.'); + $this->assertNoText($edit['name[0][value]'], 'Old URL alias has been removed after altering.'); $this->assertResponse(404, 'Old URL alias returns 404.'); } } diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index caebc53..45e7c8f 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -138,22 +138,6 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { )) ->setDisplayConfigurable('form', TRUE); - $fields['description'] = BaseFieldDefinition::create('text_long') - ->setLabel(t('Description')) - ->setDescription(t('A description of the term.')) - ->setTranslatable(TRUE) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'text_default', - 'weight' => 0, - )) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayOptions('form', array( - 'type' => 'text_textfield', - 'weight' => 0, - )) - ->setDisplayConfigurable('form', TRUE); - $fields['weight'] = BaseFieldDefinition::create('integer') ->setLabel(t('Weight')) ->setDescription(t('The weight of this term in relation to other terms.')) @@ -183,36 +167,6 @@ public function getChangedTime() { /** * {@inheritdoc} */ - public function getDescription() { - return $this->get('description')->value; - } - - /** - * {@inheritdoc} - */ - public function setDescription($description) { - $this->set('description', $description); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getFormat() { - return $this->get('description')->format; - } - - /** - * {@inheritdoc} - */ - public function setFormat($format) { - $this->get('description')->format = $format; - return $this; - } - - /** - * {@inheritdoc} - */ public function getName() { return $this->label(); } diff --git a/core/modules/taxonomy/src/TermInterface.php b/core/modules/taxonomy/src/TermInterface.php index 433f487..94cf56a 100644 --- a/core/modules/taxonomy/src/TermInterface.php +++ b/core/modules/taxonomy/src/TermInterface.php @@ -16,42 +16,6 @@ interface TermInterface extends ContentEntityInterface, EntityChangedInterface { /** - * Gets the term's description. - * - * @return string - * The term description. - */ - public function getDescription(); - - /** - * Sets the term's description. - * - * @param string $description - * The term's description. - * - * @return $this - */ - public function setDescription($description); - - /** - * Gets the text format name for the term's description. - * - * @return string - * The text format name. - */ - public function getFormat(); - - /** - * Sets the text format name for the term's description. - * - * @param string $format - * The term's decription text format. - * - * @return $this - */ - public function setFormat($format); - - /** * Gets the name of the term. * * @return string diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php index 9a1436c..a515f0a 100644 --- a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php +++ b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php @@ -62,15 +62,8 @@ function createVocabulary() { * The new taxonomy term object. */ function createTerm(Vocabulary $vocabulary, $values = array()) { - $filter_formats = filter_formats(); - $format = array_pop($filter_formats); $term = entity_create('taxonomy_term', $values + array( 'name' => $this->randomMachineName(), - 'description' => array( - 'value' => $this->randomMachineName(), - // Use the first available text format. - 'format' => $format->id(), - ), 'vid' => $vocabulary->id(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php index 72694c0..567e0f9 100644 --- a/core/modules/taxonomy/src/Tests/TermTest.php +++ b/core/modules/taxonomy/src/Tests/TermTest.php @@ -352,7 +352,6 @@ function testTermInterface() { \Drupal::service('module_installer')->install(array('views')); $edit = array( 'name[0][value]' => $this->randomMachineName(12), - 'description[0][value]' => $this->randomMachineName(100), ); // Explicitly set the parents field to 'root', to ensure that // TermForm::save() handles the invalid term ID correctly. @@ -374,11 +373,9 @@ function testTermInterface() { $this->clickLink(t('Edit'), 1); $this->assertRaw($edit['name[0][value]'], 'The randomly generated term name is present.'); - $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.'); $edit = array( 'name[0][value]' => $this->randomMachineName(14), - 'description[0][value]' => $this->randomMachineName(102), ); // Edit the term. @@ -396,21 +393,6 @@ function testTermInterface() { // View the term and check that it is correct. $this->drupalGet('taxonomy/term/' . $term->id()); $this->assertText($edit['name[0][value]'], 'The randomly generated term name is present.'); - $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.'); - - // Did this page request display a 'term-listing-heading'? - $this->assertTrue($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page displayed the term description element.'); - // Check that it does NOT show a description when description is blank. - $term->setDescription(NULL); - $term->save(); - $this->drupalGet('taxonomy/term/' . $term->id()); - $this->assertFalse($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.'); - - // Check that the description value is processed. - $value = $this->randomMachineName(); - $term->setDescription($value); - $term->save(); - $this->assertEqual($term->description->processed, "

$value

\n"); // Check that the term feed page is working. $this->drupalGet('taxonomy/term/' . $term->id() . '/feed'); @@ -490,7 +472,6 @@ function testTermMultipleParentsInterface() { // Add a new term with multiple parents. $edit = array( 'name[0][value]' => $this->randomMachineName(12), - 'description[0][value]' => $this->randomMachineName(100), 'parent[]' => array(0, $parent->id()), ); // Save the new term. @@ -501,7 +482,6 @@ function testTermMultipleParentsInterface() { $term = reset($terms); $this->assertNotNull($term, 'Term found in database.'); $this->assertEqual($edit['name[0][value]'], $term->getName(), 'Term name was successfully saved.'); - $this->assertEqual($edit['description[0][value]'], $term->getDescription(), 'Term description was successfully saved.'); // Check that the parent tid is still there. The other parent () is // not added by taxonomy_term_load_parents(). $parents = taxonomy_term_load_parents($term->id()); diff --git a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php index f25591b..cf632ad 100644 --- a/core/modules/taxonomy/src/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/src/Tests/TokenReplaceTest.php @@ -84,7 +84,6 @@ function testTaxonomyTokenReplacement() { $tests = array(); $tests['[term:tid]'] = $term1->id(); $tests['[term:name]'] = String::checkPlain($term1->getName()); - $tests['[term:description]'] = $term1->description->processed; $tests['[term:url]'] = $term1->url('canonical', array('absolute' => TRUE)); $tests['[term:node-count]'] = 0; $tests['[term:parent:name]'] = '[term:parent:name]'; @@ -99,7 +98,6 @@ function testTaxonomyTokenReplacement() { $tests = array(); $tests['[term:tid]'] = $term2->id(); $tests['[term:name]'] = String::checkPlain($term2->getName()); - $tests['[term:description]'] = $term2->description->processed; $tests['[term:url]'] = $term2->url('canonical', array('absolute' => TRUE)); $tests['[term:node-count]'] = 1; $tests['[term:parent:name]'] = String::checkPlain($term1->getName()); @@ -117,7 +115,6 @@ function testTaxonomyTokenReplacement() { // Generate and test unsanitized tokens. $tests['[term:name]'] = $term2->getName(); - $tests['[term:description]'] = $term2->getDescription(); $tests['[term:parent:name]'] = $term1->getName(); $tests['[term:vocabulary:name]'] = $this->vocabulary->name; diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php index b7fe1e9..6afc7fe 100644 --- a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php +++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php @@ -76,10 +76,9 @@ function setUp() { ))->save(); // Create term with translations. - $taxonomy = $this->createTermWithProperties(array('name' => $this->term_names['en'], 'langcode' => 'en', 'description' => $this->term_names['en'], 'field_foo' => $this->term_names['en'])); + $taxonomy = $this->createTermWithProperties(array('name' => $this->term_names['en'], 'langcode' => 'en', 'field_foo' => $this->term_names['en'])); foreach (array('es', 'fr') as $langcode) { $translation = $taxonomy->addTranslation($langcode, array('name' => $this->term_names[$langcode])); - $translation->description->value = $this->term_names[$langcode]; $translation->field_foo->value = $this->term_names[$langcode]; } $taxonomy->save(); @@ -98,10 +97,6 @@ public function testFilters() { // Should show just the Spanish translation, once. $this->assertPageCounts('test-name-filter', array('es' => 1, 'fr' => 0, 'en' => 0), 'Comida name filter'); - // Test the description filter page, which filters for description contains - // 'Comida'. Should show just the Spanish translation, once. - $this->assertPageCounts('test-desc-filter', array('es' => 1, 'fr' => 0, 'en' => 0), 'Comida description filter'); - // Test the field filter page, which filters for field_foo contains // 'Comida'. Should show just the Spanish translation, once. $this->assertPageCounts('test-field-filter', array('es' => 1, 'fr' => 0, 'en' => 0), 'Comida field filter'); @@ -110,10 +105,6 @@ public function testFilters() { // 'Paris'. Should show each translation once. $this->assertPageCounts('test-name-paris', array('es' => 1, 'fr' => 1, 'en' => 1), 'Paris name filter'); - // Test the description Paris page, which filters for description contains - // 'Paris'. Should show each translation, once. - $this->assertPageCounts('test-desc-paris', array('es' => 1, 'fr' => 1, 'en' => 1), 'Paris description filter'); - // Test the field Paris filter page, which filters for field_foo contains // 'Paris'. Should show each translation once. $this->assertPageCounts('test-field-paris', array('es' => 1, 'fr' => 1, 'en' => 1), 'Paris field filter'); @@ -136,11 +127,8 @@ protected function assertPageCounts($path, $counts, $message) { $this->drupalGet($path); $text = $this->getTextContent(); - // Check the counts. Note that the title and body are both shown on the - // page, and they are the same. So the title/body string should appear on - // the page twice as many times as the input count. foreach ($counts as $langcode => $count) { - $this->assertEqual(substr_count($text, $this->term_names[$langcode]), 2 * $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message); + $this->assertEqual(substr_count($text, $this->term_names[$langcode]), $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message); } } @@ -150,25 +138,19 @@ protected function assertPageCounts($path, $counts, $message) { * @param array $properties * Array of properties and field values to set. * - * @return \Drupal\taxonomy\Term + * @return \Drupal\taxonomy\Entity\Term * The created taxonomy term. */ protected function createTermWithProperties($properties) { - // Use the first available text format. - $filter_formats = filter_formats(); - $format = array_pop($filter_formats); $properties += array( 'name' => $this->randomMachineName(), - 'description' => $this->randomMachineName(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'field_foo' => $this->randomMachineName(), ); $term = entity_create('taxonomy_term', array( 'name' => $properties['name'], - 'description' => $properties['description'], - 'format' => $format->id(), 'vid' => $this->vocabulary->id(), 'langcode' => $properties['langcode'], )); diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc index aa1505c..68f579e 100644 --- a/core/modules/taxonomy/taxonomy.tokens.inc +++ b/core/modules/taxonomy/taxonomy.tokens.inc @@ -32,10 +32,6 @@ function taxonomy_token_info() { 'name' => t("Name"), 'description' => t("The name of the taxonomy term."), ); - $term['description'] = array( - 'name' => t("Description"), - 'description' => t("The optional description of the taxonomy term."), - ); $term['node-count'] = array( 'name' => t("Node count"), 'description' => t("The number of nodes tagged with the taxonomy term."), @@ -110,10 +106,6 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options = $replacements[$original] = $sanitize ? String::checkPlain($term->getName()) : $term->getName(); break; - case 'description': - $replacements[$original] = $sanitize ? $term->description->processed : $term->getDescription(); - break; - case 'url': $replacements[$original] = $term->url('canonical', array('absolute' => TRUE)); break; diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index 750fd73..3d86e53 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -6,7 +6,7 @@ * Available variables: * - url: URL of the current term. * - name: Name of the current term. - * - content: Items for the content of the term (fields and description). + * - content: Items for the content of the term fields. * Use 'content' to print them all, or print a subset such as * 'content.description'. Use the following code to exclude the * printing of a given child element: diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml index 133ee54..754ffc9 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_field_filters.yml @@ -133,118 +133,6 @@ display: arguments: { } field_langcode: '***LANGUAGE_language_content***' field_langcode_add_to_query: null - page_dc: - display_plugin: page - id: page_dc - display_title: 'Description Comida' - position: 3 - display_options: - field_langcode: '***LANGUAGE_language_content***' - field_langcode_add_to_query: null - display_description: '' - path: test-desc-filter - filters: - description__value: - id: description__value - table: taxonomy_term_field_data - field: description__value - relationship: none - group_type: group - admin_label: '' - operator: contains - value: Comida - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - plugin_id: string - defaults: - filters: false - filter_groups: false - title: false - filter_groups: - operator: AND - groups: - 1: AND - title: 'Description filter page' - page_dp: - display_plugin: page - id: page_dp - display_title: 'Description Comida' - position: 3 - display_options: - field_langcode: '***LANGUAGE_language_content***' - field_langcode_add_to_query: null - display_description: '' - path: test-desc-paris - filters: - description__value: - id: description__value - table: taxonomy_term_field_data - field: description__value - relationship: none - group_type: group - admin_label: '' - operator: contains - value: Paris - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - plugin_id: string - defaults: - filters: false - filter_groups: false - title: false - filter_groups: - operator: AND - groups: - 1: AND - title: 'Description filter page' page_fc: display_plugin: page id: page_fc