Please find attached the patch of my rewrites to views_plugin_style_lineage_nested.inc with the following changes:

  1. Added theme support. I've changed nested_list() so that it calls the Views theme in its recursion. Instead of going straight to output, the return from nested_list() copies over the existing array element (so Array objects are replaced with themed output strings).
  2. As a result, I made rudimentary customisations to the default Views list template and attached it as views-view-lineage-nested.tpl_.txt. You'll obviously have to change _.txt in the file name to .php, but you can now copy and theme this in your own site theme.
  3. I moved the row rendering from render() to render_nesting(). This is to reduce the number of times which the taxonomy has to be looped through by 1.
  4. Because themes automagically handle headers, header() is obsolete (and removed).
  5. I changed variable names in render(), nested_list() and render_nesting() to make them more consistent with Views terminology. I hope this doesn't offend anybody.
  6. I figured out how to run render_nesting() so that it wouldn't have to call eval(). You're welcome.
  7. Miscellaneous changes I can't remember. Check the diff (also attached)

Note the comment around line 210: @todo: remove this line once issue #1201054: Extra \n in term_lineage.lineage is resolved. This is to compensate for how the module stores information. This line of code will break the rendering once #1201054: Extra \n in term_lineage.lineage is fixed!!!

CommentFileSizeAuthor
#4 lineage-1201218-4.patch6.64 KBxjm
#3 lineage-1201218-3.patch5.74 KBxjm
#2 lineage-1201218-2.patch5.88 KBxjm
views_plugin_style_lineage_nested.diff5.73 KBAnonymous (not verified)
views-view-lineage-nested.tpl_.txt736 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

Status: Active » Needs review
xjm’s picture

FileSize
5.88 KB

Here's a version of this patch rerolled against the current HEAD, using git, and with some trailing whitespace removed.

Edit: looks like there's some indentation issues as well--tabs or something?

xjm’s picture

FileSize
5.74 KB

Other various cleanups.

xjm’s picture

FileSize
6.64 KB

...And a patch that actually includes the new template file. Sorry for the noise.

xjm’s picture

Status: Needs review » Needs work

I tested this patch today with some existing views, and unfortunately it breaks them. I noticed in particular that nodes under the main term disappeared from the listing when a grouping was used.

Anonymous’s picture

Thanks for following up. I'll look into it. The disappearing first term isn't at all related to issue #1201054: Extra \n in term_lineage.lineage, is it? My workaround may be creating an off-by-one error if the extra newline has been removed from the database.

Could I also have some sample output to help me trace the problem? A 'before patch' and 'after patch' HTML dump would be best.

Also, I use KWrite to edit PHP, so it may have turned my whitespaces into tabs. I'll check my settings but thanks for letting me know.

Anonymous’s picture

Has there been any more testing/review of my patch? Any inputs-outputs that I can use to debug?