Condition "Taxonomy Term" gets called like this:
function context_entity_prepare_view($prepare, $entity_type) {
if ($entity_type === 'taxonomy_term' && count($prepare) === 1) {
$term = reset($prepare);
if ($term === menu_get_object('taxonomy_term', 2) && $plugin = context_get_plugin('condition', 'taxonomy_term')) {
$plugin->execute($term, 'view');
}
}
}
When visiting some term pages without description (!) hook_entity_prepare_view is NOT getting called at all for term entity, because taxonomy_term_view is not called, because of condition in taxonomy_term_page:
if (!empty($term->description)) {
$build['term_heading'] = array(
'#prefix' => '<div class="term-listing-heading">',
'#suffix' => '</div>',
'term' => taxonomy_term_view($term, 'full'),
);
}
So my idea is to to put this:
if ($plugin = context_get_plugin('condition', 'taxonomy_term')) {
if (menu_get_object('taxonomy_term', 2)) {
$term = menu_get_object('taxonomy_term', 2);
$plugin->execute($term, 'view');
}
}
into context_context_page_condition() function.
Comments
Comment #1
wapnik commentedFix for this included in #748012: Free tagging taxonomy and taxonomy vocabularies as a condition, maybe you can help test there.
Comment #2
iztok commentedWorking more with this it is clear that Taxonomy module in Core should always use taxonomy_term_view() because I have troubles with Context:Menu Block (http://drupal.org/project/context_menu_block) when condition is Term page - becuase without taxonomy_term_view() active-trail does not get build.
My temp solution: I tell the client to put term description.
Comment #3
idflood commentedsubscribing
Comment #4
h3rj4n commentedThis issue is fixed inside the taxonomy module. The code addressed above doesn't exist any more. The function taxonom_term_view is now always called when viewing a taxonomy term.