Closed (fixed)
Project:
Taxonomy Term Children
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
7 Jan 2011 at 13:57 UTC
Updated:
8 Feb 2012 at 11:53 UTC
Great module, however the Alphabetical layout provided by default was a bit limited for our purpose. Would you be able to include an option to change layouts? It would make the module a little more flexible :)
I modified the theme function to present the block slightly differently, more like folders really (please see the attached). There might be better implementation than what I have done below but thought I would post it up incase anyone finds it helpful.
PHP in template.php
function knowledge_taxonomy_term_children_content($content) {
$module_path = drupal_get_path('module', 'taxonomy_term_children');
$full_path = $module_path . '/taxonomy_term_children.css';
drupal_add_css($full_path);
// get page tile & only display if subcategory content is available
$parent_cat_title = drupal_get_title();
if ($content) {
$output .= '<h3>' . $parent_cat_title .' subcategories</h3>';
}
// changes the alphabetical headed layout to a list of subcategories with term descriptions
$output .= '<ul class="categories">';
foreach ($content as $letter => $object) {
foreach ($object as $term) {
$output .= '<li class=$letter><div class="clickable-div">' . l($term->name, 'taxonomy/term/' . $term->tid) . $term->description . $node->title . '</span></li>';
}
}
$output .= '</ul>';
return $output;
}
jQuery
//clickable divs
$(".clickable-div").click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
New CSS
#block-taxonomy_term_children-0 ul.categories li {
width:50%;
margin: 0px;
padding: 0px;
}
#block-taxonomy_term_children-0 ul.categories li div {
background: url("../images/icons/16x16/folder.png") no-repeat scroll 4px 6px #EBEBEB;
border:1px solid #ccc;
margin: 4px;
padding: 4px 4px 4px 26px;
cursor:pointer;
}
| Comment | File | Size | Author |
|---|---|---|---|
| CS&B - Knowledge_1294406094374.png | 21.52 KB | westie |
Comments
Comment #1
marcoka commentedgood idea, thanks for that. i discovered some issues with the default layout too. i am using it in my drupalwiki.
i will integrate a theme switcher/style in the next version i think.
Comment #2
marcoka commentedas this is possible with views, this module is obsolete.