diff --git a/core/modules/forum/forum-list.tpl.php b/core/modules/forum/forum-list.tpl.php index 257cea9..a51f450 100644 --- a/core/modules/forum/forum-list.tpl.php +++ b/core/modules/forum/forum-list.tpl.php @@ -19,7 +19,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. @@ -54,9 +53,6 @@ icon_title; ?>
name; ?>
- description): ?> -
description; ?>
- ', $forum->depth); ?> is_container): ?> diff --git a/core/modules/forum/forum.test b/core/modules/forum/forum.test index 4561092..0d14929 100644 --- a/core/modules/forum/forum.test +++ b/core/modules/forum/forum.test @@ -294,13 +294,11 @@ class ForumTestCase extends WebTestBase { $vid = variable_get('forum_nav_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)), ); @@ -336,13 +334,11 @@ class ForumTestCase extends WebTestBase { * taxonomy_term_data created. */ 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', ); @@ -354,7 +350,7 @@ class ForumTestCase extends WebTestBase { $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created')); // 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' => variable_get('forum_nav_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' => variable_get('forum_nav_vocabulary', ''), ':name' => $name))->fetchAssoc(); $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database'); // Verify forum hierarchy. diff --git a/core/modules/path/path.test b/core/modules/path/path.test index c742ad5..4f53982 100644 --- a/core/modules/path/path.test +++ b/core/modules/path/path.test @@ -261,16 +261,15 @@ class PathTaxonomyTermTestCase extends PathTestCase { function testTermAlias() { // Create a term in the default 'Tags' vocabulary with URL alias. $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(); @@ -280,11 +279,11 @@ class PathTaxonomyTermTestCase extends PathTestCase { // 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. @@ -294,7 +293,7 @@ class PathTaxonomyTermTestCase extends PathTestCase { // 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/taxonomy-term.tpl.php b/core/modules/taxonomy/taxonomy-term.tpl.php index b1ff20e..2084de5 100644 --- a/core/modules/taxonomy/taxonomy-term.tpl.php +++ b/core/modules/taxonomy/taxonomy-term.tpl.php @@ -6,11 +6,10 @@ * * Available variables: * - $name: the (sanitized) name of the term. - * - $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. * - $term_url: Direct url of the current term. * - $term_name: Name of the current term. * - $classes: String of classes that can be used to style contextually through diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index db83d84..22b5ba6 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -697,13 +697,6 @@ function taxonomy_form_term($form, &$form_state, Term $term = NULL, Vocabulary $ '#required' => TRUE, '#weight' => -5, ); - $form['description'] = array( - '#type' => 'text_format', - '#title' => t('Description'), - '#default_value' => $term->description, - '#format' => $term->format, - '#weight' => 0, - ); $form['vocabulary_machine_name'] = array( '#type' => 'value', @@ -863,10 +856,6 @@ function taxonomy_form_term_submit_build_taxonomy_term($form, &$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/taxonomy.css b/core/modules/taxonomy/taxonomy.css index 433b3d6..77465df 100644 --- a/core/modules/taxonomy/taxonomy.css +++ b/core/modules/taxonomy/taxonomy.css @@ -8,6 +8,3 @@ tr.taxonomy-term-divider-top { tr.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 14b6956..2123a88 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -54,19 +54,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, @@ -300,3 +287,78 @@ function taxonomy_update_8001() { } } } + +/** + * Create new field for term descriptions. + */ +function taxonomy_update_8002() { + $vocabularies = taxonomy_vocabulary_load_multiple(FALSE); + if (count($vocabularies)) { + // Create a new term description field.. + $field = array( + 'field_name' => 'taxonomy_term_description', + 'type' => 'text_long', + 'entity_types' => array('taxonomy_term'), + ); + 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', + 'entity_type' => 'taxonomy_term', + 'bundle' => $vocabulary->machine_name, + 'settings' => array('text_processing' => 1), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'text_default', + 'weight' => 0, + ), + ), + ); + field_create_instance($instance); + } + } +} + +/** + * Move term descriptions in {term_data}.description into new field. + */ +function taxonomy_update_8003(&$sandbox) { + if (!isset($sandbox['progress'])) { + $sandbox['progress'] = 0; + $sandbox['current_tid'] = 0; + $sandbox['max'] = db_query('SELECT COUNT(DISTINCT tid) FROM {taxonomy_term_data}')->fetchField(); + } + + $terms = db_select('taxonomy_term_data', 't') + ->fields('t', array('tid', 'description', 'format')) + ->condition('tid', $sandbox['current_tid'], '>') + ->range(0, 100) + ->orderBy('tid', 'ASC') + ->execute(); + + foreach ($terms as $term) { + $description = $term->description; + $format = $term->format; + $term = taxonomy_term_load($term->tid); + $term->taxonomy_term_description['und'][0]['value'] = $description; + $term->taxonomy_term_description['und'][0]['format'] = $format; + taxonomy_term_save($term); + $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_8004() { + 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 7fdb8a2..912c449 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -183,18 +183,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, - ), ), ); } @@ -599,16 +587,6 @@ function taxonomy_term_view(Term $term, $view_mode = 'full', $langcode = NULL) { $build += field_attach_view('taxonomy_term', $term, $view_mode, $langcode); - // Add term description if the term has one. - if (!empty($term->description)) { - $build['description'] = array( - '#markup' => check_markup($term->description, $term->format, '', TRUE), - '#weight' => 0, - '#prefix' => '
', - '#suffix' => '
', - ); - } - $build['#attached']['css'][] = drupal_get_path('module', 'taxonomy') . '/taxonomy.css'; // Allow modules to modify the structured term. diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc index c84a6bd..da487da 100644 --- a/core/modules/taxonomy/taxonomy.pages.inc +++ b/core/modules/taxonomy/taxonomy.pages.inc @@ -69,9 +69,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'] = variable_get('site_name', 'Drupal') . ' - ' . $term->name; - // 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-publishing')->get('feed_default_items')); node_feed($nids, $channel); diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test index 55b30fa..0e27e88 100644 --- a/core/modules/taxonomy/taxonomy.test +++ b/core/modules/taxonomy/taxonomy.test @@ -52,9 +52,6 @@ class TaxonomyWebTestCase extends WebTestBase { 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, )); @@ -804,7 +801,6 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { function testTermInterface() { $edit = array( 'name' => $this->randomName(12), - 'description[value]' => $this->randomName(100), ); // Explicitly set the parents field to 'root', to ensure that // taxonomy_form_term_submit() handles the invalid term ID correctly. @@ -826,11 +822,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $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. @@ -844,15 +838,6 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // 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'); @@ -939,7 +924,6 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // 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. @@ -950,7 +934,6 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $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); @@ -1799,7 +1782,6 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase { $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]'; @@ -1814,7 +1796,6 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase { $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); @@ -1832,7 +1813,6 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase { // 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.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc index 24d7bc8..ecd4219 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 = entity_uri('taxonomy_term', $term); $replacements[$original] = url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE)));