diff options
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 9 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.install | 21 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.pages.inc | 18 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.tokens.inc | 2 |
4 files changed, 38 insertions, 12 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index f3550464f..cf5ece294 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -614,6 +614,7 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = $edit += array( 'name' => '', 'description' => '', + 'format' => filter_default_format(), 'vocabulary_machine_name' => $vocabulary->machine_name, 'tid' => NULL, 'weight' => 0, @@ -653,7 +654,9 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = '#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description'], - '#description' => t('A description of the term. To be displayed on taxonomy/term pages and RSS feeds.')); + '#description' => t('A description of the term. To be displayed on taxonomy/term pages and RSS feeds.'), + '#text_format' => $edit['format'], + ); $form['vocabulary_machine_name'] = array( '#type' => 'textfield', @@ -768,6 +771,10 @@ function taxonomy_form_term_submit($form, &$form_state) { return; } + // Massage #text_format. + $form_state['values']['format'] = $form_state['values']['description_format']; + unset($form_state['values']['description_format']); + $term = taxonomy_form_term_submit_builder($form, $form_state); $status = taxonomy_term_save($term); diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index 148322000..f641549e9 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -50,6 +50,13 @@ function taxonomy_schema() { 'description' => 'A description of the term.', 'translatable' => TRUE, ), + 'format' => array( + 'type' => 'int', + 'size' => 'small', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {filter_format}.format of the description.', + ), 'weight' => array( 'type' => 'int', 'not null' => TRUE, @@ -407,3 +414,17 @@ function taxonomy_update_7005(&$sandbox) { db_drop_table('taxonomy_term_node'); } } + +/** + * Add vocabulary machine_name column. + */ +function taxonomy_update_7006() { + db_add_field('taxonomy_term_data', 'format', array( + 'type' => 'int', + 'size' => 'small', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {filter_format}.format of the description.', + )); +} + diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc index 90ff994f0..f79dc97a3 100644 --- a/modules/taxonomy/taxonomy.pages.inc +++ b/modules/taxonomy/taxonomy.pages.inc @@ -33,14 +33,12 @@ function taxonomy_term_page($term) { field_attach_prepare_view('taxonomy_term', array($term->tid => $term), 'full'); $build = array(); $build += field_attach_view('taxonomy_term', $term); - if (!empty($term->description)) { - $build['term_description'] = array( - '#markup' => filter_xss_admin($term->description), - '#weight' => -1, - '#prefix' => '<div class="taxonomy-term-description">', - '#suffix' => '</div>', - ); - } + $build['term_description'] = array( + '#markup' => check_markup($term->description, $term->format, '', TRUE), + '#weight' => -1, + '#prefix' => '<div class="taxonomy-term-description">', + '#suffix' => '</div>', + ); if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) { $nodes = node_load_multiple($nids); $build += node_build_multiple($nodes); @@ -69,8 +67,8 @@ function taxonomy_term_feed($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, so no need to filter here. - $channel['description'] = $term->description; + // HTML will be removed from feed description. + $channel['description'] = check_markup($term->description, $term->format, '', TRUE); $nids = taxonomy_select_nodes($term->tid, FALSE, variable_get('feed_default_items', 10)); node_feed($nids, $channel); diff --git a/modules/taxonomy/taxonomy.tokens.inc b/modules/taxonomy/taxonomy.tokens.inc index c7d92ce46..1e30f2bc2 100644 --- a/modules/taxonomy/taxonomy.tokens.inc +++ b/modules/taxonomy/taxonomy.tokens.inc @@ -115,7 +115,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options = break; case 'description': - $replacements[$original] = $sanitize ? filter_xss($term->description) : $term->description; + $replacements[$original] = $sanitize ? check_markup($term->description, $term->format, '', TRUE) : $term->description; break; case 'url': |