diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.install b/core/modules/field/modules/field_sql_storage/field_sql_storage.install
index 4d4fe57..9607a9c 100644
--- a/core/modules/field/modules/field_sql_storage/field_sql_storage.install
+++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.install
@@ -118,11 +118,15 @@ function field_sql_storage_update_8000(&$sandbox) {
$table_info = array($data_table => $primary_key_data, $revision_table => $primary_key_revision);
foreach ($table_info as $table => $primary_key) {
- db_drop_primary_key($table);
- db_drop_index($table, 'language');
- db_change_field($table, 'language', 'langcode', $field_langcode);
- db_add_primary_key($table, $primary_key);
- db_add_index($table, 'langcode', $langcode_index);
+ // Do not attempt to rename the 'language' column for fields that already
+ // contain it (created during the upgrade before this update function).
+ if (db_field_exists($table, 'language')) {
+ db_drop_primary_key($table);
+ db_drop_index($table, 'language');
+ db_change_field($table, 'language', 'langcode', $field_langcode);
+ db_add_primary_key($table, $primary_key);
+ db_add_index($table, 'langcode', $langcode_index);
+ }
}
}
}
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index 67e58a2..b10e254 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -325,13 +325,11 @@ function editForumTaxonomy() {
$vid = config('forum.settings')->get('vocabulary');
$original_settings = taxonomy_vocabulary_load($vid);
- // Generate a random name/description.
+ // Generate a random name.
$title = $this->randomName(10);
- $description = $this->randomName(100);
$edit = array(
'name' => $title,
- 'description' => $description,
'machine_name' => drupal_strtolower(drupal_substr($this->randomName(), 3, 9)),
);
@@ -346,7 +344,6 @@ function editForumTaxonomy() {
// Make sure we actually edited the vocabulary properly.
$this->assertEqual($current_settings->name, $title, 'The name was updated');
- $this->assertEqual($current_settings->description, $description, 'The description was updated');
// Restore the original vocabulary.
taxonomy_vocabulary_save($original_settings);
@@ -367,13 +364,11 @@ function editForumTaxonomy() {
* The created taxonomy term data.
*/
function createForum($type, $parent = 0) {
- // Generate a random name/description.
+ // Generate a random name.
$name = $this->randomName(10);
- $description = $this->randomName(100);
$edit = array(
'name' => $name,
- 'description' => $description,
'parent[0]' => $parent,
'weight' => '0',
);
@@ -391,7 +386,7 @@ function createForum($type, $parent = 0) {
);
// Verify forum.
- $term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name AND t.description = :desc", array(':vid' => config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc();
+ $term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name", array(':vid' => config('forum.settings')->get('vocabulary'), ':name' => $name))->fetchAssoc();
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
// Verify forum hierarchy.
diff --git a/core/modules/forum/templates/forum-list.tpl.php b/core/modules/forum/templates/forum-list.tpl.php
index b169493..5242c8f 100644
--- a/core/modules/forum/templates/forum-list.tpl.php
+++ b/core/modules/forum/templates/forum-list.tpl.php
@@ -16,7 +16,6 @@
* - $forum->icon_title: Text alternative for the forum icon.
* - $forum->name: The name of the forum.
* - $forum->link: The URL to link to this forum.
- * - $forum->description: The description of this forum.
* - $forum->new_topics: TRUE if the forum contains unread posts.
* - $forum->new_url: A URL to the forum's unread posts.
* - $forum->new_text: Text for the above URL, which tells how many new posts.
@@ -55,9 +54,6 @@
icon_title; ?>
- description): ?>
- description; ?>
-
', $forum->depth); ?>
is_container): ?>
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
index 421870d..732f324 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
@@ -50,14 +50,14 @@ function testTermAlias() {
$vocabulary = taxonomy_vocabulary_load(1);
$description = $this->randomName();;
$edit = array();
- $edit['name'] = $this->randomName();
- $edit['description[value]'] = $description;
+ $name = $this->randomName();
+ $edit['name'] = $name;
$edit['path[alias]'] = $this->randomName();
$this->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add', $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
- $this->assertText($description, 'Term can be accessed on URL alias.');
+ $this->assertText($name, 'Term can be accessed on URL alias.');
// Change the term's URL alias.
$tid = db_query("SELECT tid FROM {taxonomy_term_data} WHERE name = :name", array(':name' => $edit['name']))->fetchField();
@@ -67,11 +67,11 @@ function testTermAlias() {
// Confirm that the changed alias works.
$this->drupalGet($edit2['path[alias]']);
- $this->assertText($description, 'Term can be accessed on changed URL alias.');
+ $this->assertText($name, 'Term can be accessed on changed URL alias.');
// Confirm that the old alias no longer works.
$this->drupalGet($edit['path[alias]']);
- $this->assertNoText($description, 'Old URL alias has been removed after altering.');
+ $this->assertNoText($name, 'Old URL alias has been removed after altering.');
$this->assertResponse(404, 'Old URL alias returns 404.');
// Remove the term's URL alias.
@@ -81,7 +81,7 @@ function testTermAlias() {
// Confirm that the alias no longer works.
$this->drupalGet($edit2['path[alias]']);
- $this->assertNoText($description, 'Old URL alias has been removed after altering.');
+ $this->assertNoText($name, 'Old URL alias has been removed after altering.');
$this->assertResponse(404, 'Old URL alias returns 404.');
}
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
index f81b9e5..d1669e6 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
@@ -34,13 +34,6 @@ public function form(array $form, array &$form_state, EntityInterface $term) {
'#weight' => -5,
);
- $form['description'] = array(
- '#type' => 'text_format',
- '#title' => t('Description'),
- '#default_value' => $term->description,
- '#format' => $term->format,
- '#weight' => 0,
- );
$language_configuration = module_invoke('language', 'get_default_configuration', 'taxonomy_term', $vocabulary->machine_name);
$form['langcode'] = array(
'#type' => 'language_select',
@@ -144,11 +137,6 @@ public function submit(array $form, array &$form_state) {
// Prevent leading and trailing spaces in term names.
$term->name = trim($term->name);
- // Convert text_format field into values expected by taxonomy_term_save().
- $description = $form_state['values']['description'];
- $term->description = $description['value'];
- $term->format = $description['format'];
-
return $term;
}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
index 6f4dcb2..0d5eec3 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
@@ -54,9 +54,6 @@ function createVocabulary() {
function createTerm($vocabulary) {
$term = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
- 'description' => $this->randomName(),
- // Use the first available text format.
- 'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
'vid' => $vocabulary->vid,
'langcode' => LANGUAGE_NOT_SPECIFIED,
));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index b2603d6..f3211f5 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -280,7 +280,6 @@ function testTermAutocompletion() {
function testTermInterface() {
$edit = array(
'name' => $this->randomName(12),
- 'description[value]' => $this->randomName(100),
);
// Explicitly set the parents field to 'root', to ensure that
// TermFormController::save() handles the invalid term ID correctly.
@@ -302,11 +301,9 @@ function testTermInterface() {
$this->clickLink(t('edit'));
$this->assertRaw($edit['name'], 'The randomly generated term name is present.');
- $this->assertText($edit['description[value]'], 'The randomly generated term description is present.');
$edit = array(
'name' => $this->randomName(14),
- 'description[value]' => $this->randomName(102),
);
// Edit the term.
@@ -320,15 +317,6 @@ function testTermInterface() {
// View the term and check that it is correct.
$this->drupalGet('taxonomy/term/' . $term->tid);
$this->assertText($edit['name'], 'The randomly generated term name is present.');
- $this->assertText($edit['description[value]'], 'The randomly generated term description is present.');
-
- // Did this page request display a 'term-listing-heading'?
- $this->assertPattern('|class="taxonomy-term-description"|', 'Term page displayed the term description element.');
- // Check that it does NOT show a description when description is blank.
- $term->description = '';
- taxonomy_term_save($term);
- $this->drupalGet('taxonomy/term/' . $term->tid);
- $this->assertNoPattern('|class="taxonomy-term-description"|', 'Term page did not display the term description when description was blank.');
// Check that the term feed page is working.
$this->drupalGet('taxonomy/term/' . $term->tid . '/feed');
@@ -415,7 +403,6 @@ function testTermMultipleParentsInterface() {
// Add a new term with multiple parents.
$edit = array(
'name' => $this->randomName(12),
- 'description[value]' => $this->randomName(100),
'parent[]' => array(0, $parent->tid),
);
// Save the new term.
@@ -426,7 +413,6 @@ function testTermMultipleParentsInterface() {
$term = reset($terms);
$this->assertNotNull($term, 'Term found in database.');
$this->assertEqual($edit['name'], $term->name, 'Term name was successfully saved.');
- $this->assertEqual($edit['description[value]'], $term->description, '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->tid);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index e273c1b..168cf0d 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -84,7 +84,6 @@ function testTaxonomyTokenReplacement() {
$tests = array();
$tests['[term:tid]'] = $term1->tid;
$tests['[term:name]'] = check_plain($term1->name);
- $tests['[term:description]'] = check_markup($term1->description, $term1->format);
$tests['[term:url]'] = url('taxonomy/term/' . $term1->tid, 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->tid;
$tests['[term:name]'] = check_plain($term2->name);
- $tests['[term:description]'] = check_markup($term2->description, $term2->format);
$tests['[term:url]'] = url('taxonomy/term/' . $term2->tid, array('absolute' => TRUE));
$tests['[term:node-count]'] = 1;
$tests['[term:parent:name]'] = check_plain($term1->name);
@@ -117,7 +115,6 @@ function testTaxonomyTokenReplacement() {
// Generate and test unsanitized tokens.
$tests['[term:name]'] = $term2->name;
- $tests['[term:description]'] = $term2->description;
$tests['[term:parent:name]'] = $term1->name;
$tests['[term:vocabulary:name]'] = $this->vocabulary->name;
diff --git a/core/modules/taxonomy/taxonomy.css b/core/modules/taxonomy/taxonomy.css
index 1f80d52..543666a 100644
--- a/core/modules/taxonomy/taxonomy.css
+++ b/core/modules/taxonomy/taxonomy.css
@@ -8,6 +8,3 @@
.taxonomy-term-divider-bottom {
border-top: 1px dotted #ccc;
}
-.taxonomy-term-description {
- margin: 5px 0 20px;
-}
diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install
index 25d2c06..1a41088 100644
--- a/core/modules/taxonomy/taxonomy.install
+++ b/core/modules/taxonomy/taxonomy.install
@@ -122,19 +122,6 @@ function taxonomy_schema() {
'description' => 'The term name.',
'translatable' => TRUE,
),
- 'description' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'size' => 'big',
- 'description' => 'A description of the term.',
- 'translatable' => TRUE,
- ),
- 'format' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => 'The {filter_format}.format of the description.',
- ),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
@@ -349,3 +336,93 @@ function taxonomy_update_8003(&$sandbox) {
$sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
}
+
+/**
+ * Create new field for term descriptions.
+ */
+function taxonomy_update_8004() {
+ $vocabularies = db_query("SELECT machine_name FROM {taxonomy_vocabulary}")->fetchCol();
+ if (count($vocabularies)) {
+ // Create a new term description field.
+ $field = array(
+ 'field_name' => 'taxonomy_term_description',
+ 'module' => 'text',
+ 'type' => 'text_long',
+ 'cardinality' => 1,
+ 'locked' => FALSE,
+ 'storage' => array(
+ 'type' => 'field_sql_storage',
+ 'settings' => array(),
+ ),
+ );
+ _update_7000_field_create_field($field);
+
+ // Create instances for existing vocabularies.
+ foreach ($vocabularies as $vocabulary) {
+ // Attaches the description field to each bundle.
+ $instance = array(
+ 'field_name' => 'taxonomy_term_description',
+ 'label' => 'Description',
+ 'description' => '',
+ 'entity_type' => 'taxonomy_term',
+ 'bundle' => $vocabulary,
+ 'required' => FALSE,
+ 'settings' => array('text_processing' => 1),
+ 'widget' => array(
+ 'type' => 'text_textarea',
+ 'module' => 'text',
+ 'settings' => array(
+ 'rows' => 5,
+ ),
+ ),
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'hidden',
+ 'type' => 'text_default',
+ ),
+ ),
+ );
+ _update_7000_field_create_instance($field, $instance);
+ }
+ }
+}
+
+/**
+ * Move term descriptions in {term_data}.description into new field.
+ */
+function taxonomy_update_8005(&$sandbox) {
+ if (!isset($sandbox['progress'])) {
+ $sandbox['progress'] = 0;
+ $sandbox['current_tid'] = 0;
+ $sandbox['max'] = db_query('SELECT COUNT(DISTINCT tid) FROM {taxonomy_term_data} WHERE vid > 0')->fetchField();
+ }
+
+ $terms = db_query_range('SELECT t.tid, t.description, t.format, v.machine_name FROM {taxonomy_term_data} t INNER JOIN {taxonomy_vocabulary} v ON t.vid = v.vid WHERE tid > :tid ORDER BY tid ASC', 0, 100, array(':tid' => $sandbox['current_tid']));
+
+ foreach ($terms as $term) {
+ db_insert('field_data_taxonomy_term_description')
+ ->fields(array(
+ 'entity_type' => 'taxonomy_term',
+ 'bundle' => $term->machine_name,
+ 'entity_id' => $term->tid,
+ 'revision_id' => $term->tid,
+ 'langcode' => LANGUAGE_NOT_SPECIFIED,
+ 'delta' => 0,
+ 'taxonomy_term_description_value' => $term->description,
+ 'taxonomy_term_description_format' => $term->format,
+ ))
+ ->execute();
+ $sandbox['progress']++;
+ $sandbox['current_tid'] = $term->tid;
+ }
+
+ $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
+}
+
+/**
+ * Remove {term_data}.description and {term_data}.format.
+ */
+function taxonomy_update_8006() {
+ db_drop_field('taxonomy_term_data', 'description');
+ db_drop_field('taxonomy_term_data', 'format');
+}
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 874c78a..2213938 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -198,18 +198,6 @@ function taxonomy_field_extra_fields() {
'description' => t('Term name textfield'),
'weight' => -5,
),
- 'description' => array(
- 'label' => t('Description'),
- 'description' => t('Term description textarea'),
- 'weight' => 0,
- ),
- ),
- 'display' => array(
- 'description' => array(
- 'label' => t('Description'),
- 'description' => t('Term description'),
- 'weight' => 0,
- ),
),
);
}
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index fe29aaf..f8da1cc 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -73,9 +73,6 @@ function taxonomy_term_page(Term $term) {
function taxonomy_term_feed(Term $term) {
$channel['link'] = url('taxonomy/term/' . $term->tid, array('absolute' => TRUE));
$channel['title'] = config('system.site')->get('name') . ' - ' . $term->label();
- // Only display the description if we have a single term, to avoid clutter and confusion.
- // HTML will be removed from feed description.
- $channel['description'] = check_markup($term->description, $term->format, '', TRUE);
$nids = taxonomy_select_nodes($term->tid, FALSE, config('system.rss')->get('items.limit'));
return node_feed($nids, $channel);
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index c7847b3..22a44b6 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -29,10 +29,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."),
@@ -105,10 +101,6 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
$replacements[$original] = $sanitize ? check_plain($term->name) : $term->name;
break;
- case 'description':
- $replacements[$original] = $sanitize ? check_markup($term->description, $term->format, '', TRUE) : $term->description;
- break;
-
case 'url':
$uri = $term->uri();
$replacements[$original] = url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE)));
diff --git a/core/modules/taxonomy/templates/taxonomy-term.tpl.php b/core/modules/taxonomy/templates/taxonomy-term.tpl.php
index 712e83c..1687c6e 100644
--- a/core/modules/taxonomy/templates/taxonomy-term.tpl.php
+++ b/core/modules/taxonomy/templates/taxonomy-term.tpl.php
@@ -5,11 +5,10 @@
* Default theme implementation to display a term.
*
* Available variables:
- * - $content: An array of items for the content of the term (fields and
- * description). Use render($content) to print them all, or print a subset
- * such as render($content['field_example']). Use
- * hide($content['field_example']) to temporarily suppress the printing of a
- * given element.
+ * - $content: An array of items for the content of the term (fields). Use
+ * render($content) to print them all, or print a subset such as
+ * render($content['field_example']). Use hide($content['field_example'])
+ * to temporarily suppress the printing of a given element.
* - $url: Direct url of the current term.
* - $label: Name of the current term.
* - $attributes: An instance of Attributes class that can be manipulated as an
diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install
index 87fb69f..8608a0e 100644
--- a/core/profiles/standard/standard.install
+++ b/core/profiles/standard/standard.install
@@ -253,7 +253,7 @@ function standard_install() {
$user_settings = config('user.settings');
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
- // Create a default vocabulary named "Tags", enabled for the 'article' content type.
+ // Create a default vocabulary named "Tags", enabled for the 'article' content type. Include a description field on terms for "Tags".
$description = st('Use tags to group articles on similar topics into categories.');
$help = st('Enter a comma-separated list of words to describe your content.');
$vocabulary = entity_create('taxonomy_vocabulary', array(
@@ -266,6 +266,29 @@ function standard_install() {
taxonomy_vocabulary_save($vocabulary);
$field = array(
+ 'field_name' => 'taxonomy_term_description',
+ 'type' => 'text_long',
+ 'entity_types' => array('taxonomy_term'),
+ );
+ field_create_field($field);
+
+ $instance = array(
+ 'field_name' => 'taxonomy_term_description',
+ 'label' => 'Description',
+ 'entity_type' => 'taxonomy_term',
+ 'bundle' => 'tags',
+ 'settings' => array('text_processing' => 1),
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'hidden',
+ 'type' => 'text_default',
+ 'weight' => 0,
+ ),
+ ),
+ );
+ field_create_instance($instance);
+
+ $field = array(
'field_name' => 'field_' . $vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
// Set cardinality to unlimited for tagging.