This is possible with a combination of
The trick is to have a different view mode per taxonomy depth.
You can then use views_content + ds dynamic fields to have dedicated views show up on each view mode. This is covered in depth in other questions on drupal.stackexchange.com and drupal.org, so I'm not going to repeat it here. Instead I am going to focus on the entityaspect stuff.
Custom module code:
/**
* Implements hook_entityaspect()
*
* @param entityaspect_InjectedAPI_hookEntityAspect $api
*/
function e4btcmod_entityaspect($api) {
$api->type('taxonomy_term')
// Create dedicated view mode for top-level term pages.
// (other terms can use the "full" view mode)
->viewMode('term_toplevel_page', 'Top-level term page')
// Let entityaspect control "taxonomy/term/%"
->hijackPage('taxonomy/term/%')
;
}
/**
* Implements hook_entityaspect_page__ENTITYTYPE()
* This is responsible for
* - Deciding what to show on the page, if it is being visited.
* - Setting a title for the page and for the link.
* - Deciding whether this is a tab, the tab weight, etc.
* - Access checking:
* If you tell entityaspect to show something specific on the page,
*
* @param entityaspect_InjectedAPI_hookEntityAspectPage $api
* @param stdClass $term
* @param string $route
*/
function MYMODULE_entityaspect_page__taxonomy_term($api, $term, $route) {
// Only act on taxonomy/term/% route.
if ('taxonomy/term/%' !== $route) {
return;
}
// Access check.
// @todo: I don't remember atm if entityaspect already does a basic entity view access check.
if (!does_the_user_have_access($term)) {
// In case of no access, we simply return and do nothing.
return;
}
// The term name should be the page and link title.
$api->title($term->name);
switch ($term->vocabulary_machine_name) {
case 'my_vocab':
// Determine if it is a top-level term.
$parent_terms = taxonomy_get_parents($term->tid);
if (empty($parent_terms)) {
// Use a dedicated view mode for top-level terms in cnet_categories.
$api->viewMode('term_toplevel_page');
return;
}
// Fall through to "default" case.
default;
// Terms of other vocabularies, and deeper-level terms of my_vocab.
// Let taxonomy_display handle the output.
$api->pageCallback('taxonomy_display_taxonomy_term_page', array($term));
return;
}
}