Port to drupal 6.x: I18n
reikiman - February 16, 2008 - 21:33
| Project: | Taxonomy context |
| Version: | HEAD |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed |
Description
I ran the coder (code review) module and it showed me some changes.
There are some remaining issues:
Line 432: new hook_theme() function is required to register theme_ functions (Drupal Docs)
function theme_taxonomy_context_subterms($terms) {
severity: criticalLine 40: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
if ($may_cache) {
severity: criticalLine 41: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
$items[] = array(
severity: criticalLine 49: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
$items[] = array(
severity: criticalLine 56: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
$items[] = array(
severity: normalLine 516: string concatenation should be formatted without a space separating the operators (dot .) and a quote
$where = 'WHERE tn.tid = %d ' .
taxonomy_context.install
severity: criticalclick to read moreLine 8: A new schema API has been added in 6.x (Drupal Docs)
switch ($GLOBALS['db_type']) {| Attachment | Size |
|---|---|
| taxonomy_context.diff | 9.58 KB |

#1
#2
Slightly better patch, including all the missing stuff from reikiman's. I haven't bothered with the cosmetic/coding standards changes either, just to keep the patch easier to review for the task in the issue title!
I was just starting to test this when I realised that Drupal 6 now supports the display of taxonomy/term descriptions by default (see this issue). This was the main reason I used the module, so I'm not sure how much more time I will commit to this. Of course, Drupal core still doesn't have the
/taxonomy/vocabulary/xpages or the context block provided here, so perhaps the module just needs a little rethinking.Hope this helps someone, anway.
#3
Thank you, it helped me. I am attaching the entire package for 6.1
#4
Would anyone be interested in creating/maintaining a D6 branch for taxonomy context? I am currently too swamped to add support for D6 right now.
Also, a version 2.0 of Taxonomy Context will hopefully be available soon. I would like to avoid having four branches of development (e.g. 5.x-1.x, 5.x-2.x, 6.x-1.x, 6.x-2.x) as I just don't have the time to support all of them (not to mention the joys of working with multiple CVS branches). So any thoughts or suggestions on this are much appreciated!
Version 2.0 will be adding a ton of features that I have found useful. I will be posting an official announcement soon that will describe the new features.
#5
I can probably test a 6.0 version of the module out, but I'm still learning the backend of Drupal, so I'm not comfortable with doing any major programming in it. However, I must say, I really do like the module and would hate to see it be only a version 5 one. It makes working with Drupal a lot easier! I wish I had discovered this module a lot earlier in my Drupal career, it would have saved me a bunch of headaches!
#6
Okay. I just released a dev of version 2. I think this is the version that I would like to see ported to Drupal 6, but I think it would be best to get any issues worked out with the the D-5 version before porting to D-6.
#7
Subscribing so I can help test.
Edit: The zipped version of Taxonomy Context in #3 actually works quite well on Drupal 6.2. I haven't received any errors or complaints so far. I was able to configure my Taxonomy block for a vocab and test it out. :-)
#8
Nice let me test as well :P
#9
subscribe.. and reviewing..
#10
Subscribing.
An news on version 2 for Drupal 6?
#11
Subscribing
#12
It works in 6.6, sort of. It gives me what I want that is a list of terms on the vocabulary page and a list of child terms on parent terms. It doesn't, however, do the breadcrumbs for items not in the navigation menu, even if you tell it to do it in the content type. I think that has something to do with how breadcrumbs are handled in Drupal 6. That's what I have Menu Breadcrumb for.
#13
In my opinion it's working (#3).
#14
I'm using this on v6.6 in order to display child terms on the parent term page. Is there any way to set it to only show the child-terms which actually have a node?
Thanks,
Dan
#15
Where i can download the latest version of this module for Drupal 6?
Thanks.
#16
subscribe
#17
Subscribing, very interested in a D6 working version to test further.
Thanks a lot for the great work done already.
Greetings,
Martijn
#18
To get taxonomy_context working on node pages context, change line 301 of the patched module (#3).
Change line 301 from:
<?php$tidscurr = taxonomy_node_get_terms(arg(1));
?>
to
<?php$tidscurr = taxonomy_node_get_terms(node_load(arg(1)));
?>
First argument of this function must be an node object now in D6: http://api.drupal.org/api/function/taxonomy_node_get_terms/6
After this small fix context breadcrumbs on node pages are showing properly (if you enable it on nodetype form) and also an appropriate item in a taxonomy_context menu is activated.
#19
Updated ported version of the module (#3). (Just the one line changed ^^^)
#20
subscribe
#21
subscribe
#22
subs
#23
Is this port based on 5.x-1.x or 5.x-2.x?
#24
@NancyDru: 5.x-1.x probably
From first patch:
-version = "5.x-1.x-dev"+version = "6.x-1.x-dev"
#25
I am working exclusively with V2, which seems to be the future of this module. The sooner it is fully tested by the community, the sooner it will be ported to D6.
#26
Thank you Nancy. I am not working with a Drupal 5 dev at the moment, but as soon as I have some more time, I will put one up and help test
#27
I downloaded the module at Post #19. I am using Drupal 6.10.
I can see the admin settings at admin/settings/taxonomy_context
But there are no blocks for my vocabularies on the Blocks admin page.
I tried disabling and re-enabling the module, but Blocks do not appear on Blocks admin page.
Thanks. Let me know if you have further questions.
#28
I disabled, uninstalled, then deleted the module folder for the item at #19, downloaded the item from post #3.
Reinstalled, Enabled module. Went to settings page, saved default configuration.
Went to Blocks admin. No Blocks.
No one else is seeing this issue? Again, Drupal 6.10.
Went back to the #19 module after a disable/uninstall.
No blocks show up in the Blocks page.
#29
I haven't started trying to do D6 yet.
#30
I did notice the thread marked as "postponed" but I was curious if anyone else who downloaded either of the above two ports had experienced the same issue. Some above comments lead me to believe people have it working in D6.x installations.
This module does exactly what I need (for D5) but I chose D6 to build my customer's online store with, and I really can't go back. Most everything I need is available for D6, though. I'd love to have this for D6. I'm working with Taxonomy Menu and am having all sorts of weird issues with it, and Taxonomy Menu of course doesn't have the contextual abilities I'd like.
In any case, thank you for taking it on, good luck with it, and I am happy to assist in any way you need. :)
#31
for support i18n for multilanguage sites:
In function taxonomy_context_menu_tree($vid, $tid = NULL) need change
<?phpforeach ($terms as $term) {
$params = array('title' => $term->description ? strip_tags(node_teaser($term->description)) : t('View this section'));
$link = l($term->name, taxonomy_term_path($term), $params);
?>
to
<?phpforeach ($terms as $term) {
$params = array('title' => $term->description ? strip_tags(node_teaser($term->description)) : t('View this section'));
$termName = $term->name;
if (module_exists('i18ntaxonomy')) {
$termName = tt("taxonomy:term:$term->tid:name", $term->name, NULL, TRUE);
}
$link = l($termName, taxonomy_term_path($term), $params);
?>
In function theme_taxonomy_context_term($term) need change
<?php$output .= " <div class=\"$type\">\n";
if ($term->subterm) {
$output .= ' <h2 class="title">' . l($term->name, taxonomy_term_path($term)) . "</h2>\n";
}
if ($term->teaser) {
$output .= ' <div class="teaser">' . $term->teaser . "</div>\n";
} else {
$output .= ' <div class="description">' . $term->description . "</div>\n";
}
if ($term->links) {
$output .= ' <div class="links">'. theme('links', $term->links) . "</div>\n";
}
$output .= " </div>\n";
?>
to
<?php$output .= " <div class=\"$type\">\n";
if ($term->subterm) {
$termName = $term->name;
if (module_exists('i18ntaxonomy')) {
$termName = tt("taxonomy:term:$term->tid:name", $term->name, NULL, TRUE);
}
$output .= ' <h2 class="title">' . l($termName, taxonomy_term_path($term)) . "</h2>\n";
}
if ($term->teaser) {
$termTeaser = $term->teaser;
if (module_exists('i18ntaxonomy')) {
$termTeaser = tt("taxonomy:term:$term->tid:description", $term->description, NULL, FALSE);
}
$output .= ' <div class="teaser">' . $termTeaser . "</div>\n";
} else {
$termDescription = $term->description;
if (module_exists('i18ntaxonomy')) {
$termDescription = tt("taxonomy:term:$term->tid:description", $term->description, NULL, TRUE);
}
$output .= ' <div class="description">' . $termDescription . "</div>\n";
}
if ($term->links) {
$output .= ' <div class="links">'. theme('links', $term->links) . "</div>\n";
}
$output .= " </div>\n";
?>
In function taxonomy_context_block($op = 'list', $delta = 0, $edit = array()) need change
<?phpcase 'view':
if (variable_get('taxonomy_context_block_display_'. $delta, 1) == 0 && $delta != $context->vid) {
return;
}
$vocabulary = taxonomy_vocabulary_load($delta);
$block['subject'] = check_plain($vocabulary->name);
$block['content'] = taxonomy_context_menu_tree($delta, NULL, TRUE) . "\n";
?>
to
<?phpcase 'view':
if (variable_get('taxonomy_context_block_display_'. $delta, 1) == 0 && $delta != $context->vid) {
return;
}
$vocabulary = taxonomy_vocabulary_load($delta);
$vocabularyName = $vocabulary->name;
if (module_exists('i18ntaxonomy')) {
if (i18ntaxonomy_vocabulary($delta) == I18N_TAXONOMY_LOCALIZE) {
$vocabularyName = tt("taxonomy:vocabulary:$delta:name", $vocabulary->name, NULL, TRUE);
}
}
$block['subject'] = check_plain($vocabularyName);
$block['content'] = taxonomy_context_menu_tree($delta, NULL, TRUE) . "\n";
?>
#32
Big thanks for this, EliteMonk It's working on my localhost and I am planning to update it on my server soon.
#33
Note that
module_exists('i18ntaxonomy')is much slower thanfunction_exists('tt').#34
Still after #32, the vocabulary page is not displaying any term/node.
#35
subscribing
Greetings, -asb
#36
In #31 added i18n support for block name
In function taxonomy_context_block($op = 'list', $delta = 0, $edit = array()) need change
<?phpcase 'view':
if (variable_get('taxonomy_context_block_display_'. $delta, 1) == 0 && $delta != $context->vid) {
return;
}
$vocabulary = taxonomy_vocabulary_load($delta);
$block['subject'] = check_plain($vocabulary->name);
$block['content'] = taxonomy_context_menu_tree($delta, NULL, TRUE) . "\n";
?>
to
<?phpcase 'view':
if (variable_get('taxonomy_context_block_display_'. $delta, 1) == 0 && $delta != $context->vid) {
return;
}
$vocabulary = taxonomy_vocabulary_load($delta);
$vocabularyName = $vocabulary->name;
if (module_exists('i18ntaxonomy')) {
if (i18ntaxonomy_vocabulary($delta) == I18N_TAXONOMY_LOCALIZE) {
$vocabularyName = tt("taxonomy:vocabulary:$delta:name", $vocabulary->name, NULL, TRUE);
}
}
$block['subject'] = check_plain($vocabularyName);
$block['content'] = taxonomy_context_menu_tree($delta, NULL, TRUE) . "\n";
?>
#37
In #31 update i18n support for subterms
In function theme_taxonomy_context_term($term) need change
<?php$output .= " <div class=\"$type\">\n";
if ($term->subterm) {
$output .= ' <h2 class="title">' . l($term->name, taxonomy_term_path($term)) . "</h2>\n";
}
if ($term->teaser) {
$output .= ' <div class="teaser">' . $term->teaser . "</div>\n";
} else {
$output .= ' <div class="description">' . $term->description . "</div>\n";
}
if ($term->links) {
$output .= ' <div class="links">'. theme('links', $term->links) . "</div>\n";
}
$output .= " </div>\n";
?>
to
<?php$output .= " <div class=\"$type\">\n";
if ($term->subterm) {
$termName = $term->name;
if (module_exists('i18ntaxonomy')) {
$termName = tt("taxonomy:term:$term->tid:name", $term->name, NULL, TRUE);
}
$output .= ' <h2 class="title">' . l($termName, taxonomy_term_path($term)) . "</h2>\n";
}
global $language;
if ($term->teaser) {
$termTeaser = $term->teaser;
if (module_exists('i18ntaxonomy')) {
if ($language->language != 'en') {
$termTeaser = tt("taxonomy:term:$term->tid:description", $term->description, NULL, FALSE);
}
}
$output .= ' <div class="teaser">' . $termTeaser . "</div>\n";
} else {
$termDescription = $term->description;
if (module_exists('i18ntaxonomy')) {
if ($language->language != 'en') {
$termDescription = tt("taxonomy:term:$term->tid:description", $term->description, NULL, TRUE);
}
}
$output .= ' <div class="description">' . $termDescription . "</div>\n";
}
if ($term->links) {
$output .= ' <div class="links">'. theme('links', $term->links) . "</div>\n";
}
$output .= " </div>\n";
?>
#38
Additional setting in setting page for this module. Allow display count nodes after term name in block.
====================
After this code:
<?php/**
* Display menu items expanded.
*/
define('TAXONOMY_CONTENT_BLOCK_DISPLAY_EXPANDED', 1);
?>
need paste this code:
<?php
/**
* Display menu items without count nodes.
*/
define('TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_FALSE', 0);
/**
* Display menu items with count nodes.
*/
define('TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_TRUE', 1);
?>
====================
In function taxonomy_context_menu_tree($vid, $tid = NULL) need replace
<?php$termName = $term->name;
if (module_exists('i18ntaxonomy')) {
$termName = tt("taxonomy:term:$term->tid:name", $term->name, NULL, TRUE);
}
$link = l($termName, taxonomy_term_path($term), $params);
?>
to
<?php$termName = $term->name;
if (module_exists('i18ntaxonomy')) {
$termName = tt("taxonomy:term:$term->tid:name", $term->name, NULL, TRUE);
}
if (variable_get('taxonomy_context_block_count_nodes', TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_FALSE) == TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_TRUE) {
$termName .= ' (' . taxonomy_term_count_nodes($term->tid) . ')';
}
$link = l($termName, taxonomy_term_path($term), $params);
?>
====================
In function taxonomy_context_admin_settings() need replace
<?php$form['general_settings']['taxonomy_context_block_display'] = array(
'#type' => 'select',
'#title' => t('Show block items'),
'#default_value' => variable_get('taxonomy_context_block_display', TAXONOMY_CONTEXT_BLOCK_DISPLAY_COLLAPSED),
'#options' => array(t('Collapsed'), t('Expanded')),
'#description' => t('Do you want items on the menu expanded or collapsed by default?'),
);
return system_settings_form($form);
?>
to
<?php$form['general_settings']['taxonomy_context_block_display'] = array(
'#type' => 'select',
'#title' => t('Show block items'),
'#default_value' => variable_get('taxonomy_context_block_display', TAXONOMY_CONTEXT_BLOCK_DISPLAY_COLLAPSED),
'#options' => array(t('Collapsed'), t('Expanded')),
'#description' => t('Do you want items on the menu expanded or collapsed by default?'),
);
$form['general_settings']['taxonomy_context_block_count_nodes'] = array(
'#type' => 'select',
'#title' => t('Show count nodes in block items'),
'#default_value' => variable_get('taxonomy_context_block_count_nodes', TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_FALSE),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Show count nodes in block after items. Example: term (X)'),
);
return system_settings_form($form);
?>
#39
Question:
How make new project on this site expamle "Taxonomy Context 2" or update old project...
#40
Is this port to Drupal 6 working good?
And there is a question for EliteMonk. You have made some modifications. Maybe you can pack modified files into archive and publish here?
It would be better for users looking for Drupal 6 port.
#41
Where can we find a Drupal 6 Port to test?