Module currently contains hard-coded HTML in several non-themable functions which makes it non-completely themeable:

  • taxonomy_context_show_children
  • taxonomy_context_show_nodes
  • taxonomy_context_vocabulary_page
  • taxonomy_context_show_subterms

I think it would be better to move all layout code to themeable functions. If you agree to this change, I can prepare a patch for it.

CommentFileSizeAuthor
#3 taxonomy_context.module_2.patch1.08 KBfgm

Comments

nedjo’s picture

Yes please!

fgm’s picture

Assigned: Unassigned » fgm
Priority: Critical » Normal
Status: Active » Needs review

I've committed version 1.43.2.4, which includes a fairly large set of changes to the code. It doesn't solve the entire issue, but is there for testing.

This version removes the recursion in block building, obsoletes two "*show*" functions and replaces them by cleanly separated data generation and themeing functions, and also removes some dead code.

Functionality should be unchanged.

I'll continue working on it to apply the same changes to taxonomy_context_show_term and taxonomy_context_show_subterm.

Please comment on new version.

fgm’s picture

StatusFileSize
new1.08 KB

Additional warning: testing on a large site evidenced some errors that weren't apparent on a smaller one, notably with multiple vocabularies.

Also, there's some improper li/ul nesting being created in some cases. By all means don't use version 1.43.2.4 on a live site.

You can apply this patch on top of 1.43.2.4 to fix the issue with multiple vocabularies.

fgm’s picture

Version 1.43.2.5 now

  • includes a better fix
  • corrects the anomalies I noticed on the previous version of the block
  • fixes an older bug in taxonomy_context_menu (use of callback_arguments instead of callback arguments)
  • brings fully themable vocabulary pages for taxonomy/vocabulary/[vid]/[edit]
exhuma’s picture

Alright. I see I have the latest version (including fgm's patch). But how do you actually go about theming this modlue?
I have the problem that there is way too much whitespace in between subterms. I don't have any description for the terms, so that block is essentially not needed.

I would myself like to theme it in a way that it simply creates an unordered list of the subterms. Is that possible?

fgm’s picture

If you have the latest version and my patches, you have 6 themeable functions in taxonomy_context:

  • theme_taxonomy_context_children_list: used to display the site tree below a given tid
  • theme_taxonomy_context_nodes: used to display a themed set of LI link elements (without the list wrapper: UL, OL), below a given tid
  • theme_taxonomy_context_term: used to obtain the themed DIV for a term or subterm
  • theme_taxonomy_context_vocabulary: used to display a themed vocabulary description
  • theme_taxonomy_context_vocabulary_list: used to display a themed list of the terms in a vocabulary
  • theme_taxonomy_context_vocabulary_page: used to display a themed vocabulary page

I'm not sure what you're trying to achieve: it seems to relate to the first of the functions above. When you want to override it in your theme, you can obtain the context from taxonomy_context_get_context and the full tree _taxonomy_context_build_tree. You'll then choose in your code what you want to display from these data. By default theme_taxonomy_context_children_list displays all the terms below the tid, but you may want to reduce the quantity of information.

fgm’s picture

Exhuma, you apparently used the theme since late july. Did you notice specific issues (your drupal.org account is set no to receive emails) ?

Apparently other users are worried by all the changes introduced with this patch, but no one reviewed it since your last question.

nedjo’s picture

Status: Needs review » Closed (won't fix)

This direction, while promising, was rolled back due to various problems.