- Patch #796692 by dman, cross, andypost, aaronbauman, yched, BarisW: only show the term heading if the term has a description.
parent
25f8da3ff5
commit
c09288a94e
|
@ -694,12 +694,15 @@ function taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL) {
|
||||||
|
|
||||||
$build += field_attach_view('taxonomy_term', $term, $view_mode, $langcode);
|
$build += field_attach_view('taxonomy_term', $term, $view_mode, $langcode);
|
||||||
|
|
||||||
$build['description'] = array(
|
// Add term description if the term has one.
|
||||||
'#markup' => check_markup($term->description, $term->format, '', TRUE),
|
if (!empty($term->description)) {
|
||||||
'#weight' => 0,
|
$build['description'] = array(
|
||||||
'#prefix' => '<div class="taxonomy-term-description">',
|
'#markup' => check_markup($term->description, $term->format, '', TRUE),
|
||||||
'#suffix' => '</div>',
|
'#weight' => 0,
|
||||||
);
|
'#prefix' => '<div class="taxonomy-term-description">',
|
||||||
|
'#suffix' => '</div>',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$build['#attached']['css'][] = drupal_get_path('module', 'taxonomy') . '/taxonomy.css';
|
$build['#attached']['css'][] = drupal_get_path('module', 'taxonomy') . '/taxonomy.css';
|
||||||
|
|
||||||
|
@ -727,6 +730,7 @@ function template_preprocess_taxonomy_term(&$variables) {
|
||||||
$variables = array_merge((array) $term, $variables);
|
$variables = array_merge((array) $term, $variables);
|
||||||
|
|
||||||
// Helpful $content variable for templates.
|
// Helpful $content variable for templates.
|
||||||
|
$variables['content'] = array();
|
||||||
foreach (element_children($variables['elements']) as $key) {
|
foreach (element_children($variables['elements']) as $key) {
|
||||||
$variables['content'][$key] = $variables['elements'][$key];
|
$variables['content'][$key] = $variables['elements'][$key];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,12 @@ function taxonomy_term_page($term) {
|
||||||
drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
|
drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);
|
||||||
|
|
||||||
$build = array();
|
$build = array();
|
||||||
// Add term heading if the term has a description
|
|
||||||
if (!empty($term->description)) {
|
$build['term_heading'] = array(
|
||||||
$build['term_heading'] = array(
|
'#prefix' => '<div class="term-listing-heading">',
|
||||||
'#prefix' => '<div class="term-listing-heading">',
|
'#suffix' => '</div>',
|
||||||
'#suffix' => '</div>',
|
'term' => taxonomy_term_view($term, 'full'),
|
||||||
'term' => taxonomy_term_view($term, 'full'),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
|
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
|
||||||
$nodes = node_load_multiple($nids);
|
$nodes = node_load_multiple($nids);
|
||||||
|
|
|
@ -648,12 +648,12 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
|
||||||
$this->assertText($edit['description[value]'], t('The randomly generated term description is present.'));
|
$this->assertText($edit['description[value]'], t('The randomly generated term description is present.'));
|
||||||
|
|
||||||
// Did this page request display a 'term-listing-heading'?
|
// Did this page request display a 'term-listing-heading'?
|
||||||
$this->assertPattern('|class="term-listing-heading"|', 'Term page displayed the term description element.');
|
$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.
|
// Check that it does NOT show a description when description is blank.
|
||||||
$term->description = '';
|
$term->description = '';
|
||||||
taxonomy_term_save($term);
|
taxonomy_term_save($term);
|
||||||
$this->drupalGet('taxonomy/term/' . $term->tid);
|
$this->drupalGet('taxonomy/term/' . $term->tid);
|
||||||
$this->assertNoPattern('|class="term-listing-heading"|', 'Term page did not display the term description when description was blank.');
|
$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.
|
// Check that the term feed page is working.
|
||||||
$this->drupalGet('taxonomy/term/' . $term->tid . '/feed');
|
$this->drupalGet('taxonomy/term/' . $term->tid . '/feed');
|
||||||
|
|
Loading…
Reference in New Issue