I had the problem that I wanted to fully customize the content of taxonomy term pages. DS lets you add new fields, but there is currently no way to remove the hardcoded list which is always shown on the page. Many people use a View replacement, but that way you can't add the DS fields any more.
Here is a quick solution I came up with to remove everything except for the DS fields...
function mymodule_menu_alter(&$items) {
if (!empty($items['taxonomy/term/%taxonomy_term'])) {
$items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_term_page';
}
}
function mymodule_term_page($term) {
drupal_set_title($term->name);
$build = taxonomy_term_view($term, 'full');
$layout = ds_get_layout($build['#entity_type'], $build['#bundle'], $build['#view_mode']);
$build = array_intersect_key($build, $layout['settings']['fields']);
return $build;
}
Maybe this solution or a similar one is something worthy of becoming a DS extra.
Of course, if you still want a list on the page, you have to add it back in. I use the EVA module for this, which lets you add a View list as a field.
Comments
Comment #1
milos.kroulik commentedThanks!
Just what I needed.Well, not all is that great, because it disables Display suite layouts. I wonder why.
Comment #2
swentel commentedThat's a really hard one. To be honest, I'd use a panel override here. I'm also going to expose all ds custom fields as panes in the second branch this weekend.
Comment #3
nicholas.alipaz commentedI just moved all my taxonomy results into a views block display and get the tid from the arguments. I put my block into the term's display suite fields region using a block field. But I can't seem to remove the results coming from core. Any ideas?
Comment #4
nicholas.alipaz commentedJust found this little gem:
https://drupal.org/project/disable_term_node_listings
Solved it for me.