The sandbox url is http://drupal.org/sandbox/bazzic/1086442
Views Taxonomy Grid requires Views 3 and installs two views plugins.
The taxonomy grid style plugin creates a grid with x and y axes determined by taxonomy terms. You can configure the number of columns that you display, like a regular grid. You have to add two 'taxonomy: term ID' filters to create your x and y axes. Nodes that are tagged with the x and y taxonomy terms for each cell are displayed in the cell.
The X-axis pager plugin allows you move along the x-axis of your grid if you have more terms in your x-axis vocabulary than columns.
Motivation
I developed a custom module for a client in the education sector that displayed content in a taxonomy driven grid. For example, one of the grids displayed learning objectives for students and displayed these objectives with school year on the x-axis and strand on the y-axis. It turned into a huge module with extremely specific requirements that I felt would never be useful to the community. Views Taxonomy Grid is a much more generic way to create grids using taxonomy combined with all of the flexibility of Views.
Comments
Comment #1
avpadernoComment #2
joachim commentedSounds pretty nifty!
Not installed this, just read through the code.
At first glance, well laid-out, follows style guidelines. Do run this through coder to pick up stray spacing and indentation issues though; I can see a few.
Here's what I've found on readthrough...
- hook_init is not the best place for this:
* Display message on modules page if requirements not met
Modules that do this are annoying. Use hook_requirements perhaps? A one-off nag message in hook_enable is okay too, though you should be able to nag from hook_requirements(). Rather though, you should just refuse to enable the module if we're not on Views 3; that's perfectly legitimate.
- Not actually true! ;)
* Most of the views hooks are kept in here.
- Follow standard capitalization:
name = Views Taxonomy Grid
- docblock on every function:
function _views_taxonomy_grid_check(){
(Though do you really need this to be farmed out from hook_requirements?)
- views_taxonomy_grid_views_query_alter -- I may be wrong, but can't plugin classes alter the query from within the class code? Not sure though...
- the $row_class logic in views-taxonomy-grid-view.tpl.php really should be in the preprocessor
Comment #3
bazzic commentedThanks so much for the feedback, joachim! I have cleaned up everything around the Views 3 dependency and now you cannot install the module unless you have Views 3 installed. I used hook_requirements() to accomplish this.
All of your other feedback makes sense and I have made the appropriate changes. Please take another look at the module when you have a chance.
Comment #4
bazzic commentedThis has been sitting for a while, so just posting to see if a reviewer can take another look. Much appreciated.
Comment #5
bazzic commentedAgain, just posting to see if a reviewer can take another look. Thanks.
Comment #6
joachim commentedYou need a newline at the end of every file -- other than that it's looking good.
Comment #7
bazzic commentedI have added the newlines.
Comment #8
joachim commentedI'm not seeing one in views_taxonomy_grid.module...
Also...
That's great, but it's just reading the code back to me. You need to actually *say* what all these are... ;)
Comment #9
bazzic commentedI have added comments for the doxygen function headers. All of the files should now have a newline as the last character.
Comment #10
bazzic commentedDid a bit more cleanup of the comments.
Comment #11
carinadigital commentedI have had a quick look through the module since this applications has been ongoing since March. I want to declare my interest here, as I have committed to this project and know the developer.
From #2, maybe hook_init isn't the best place to add CSS. How about in the plugin?
Override inherited functions init() or render() from views_plugin_style in views_plugin_style_taxonomy_grid
A run of the module through coder and coder tough love brought up minor documentation formatting errors.
e.g. views_taxonomy_grid.module Line 5: Function documentation should be less than 80 characters per line.
The module is well written and follows drupal style guidelines. Issues with the module are minor.
The module is unique and is a useful addition to views.
Comment #12
bazzic commentedI moved the drupal_add_css call from hook_init to the pre_render method of the taxonomy grid style plugin. I also cleaned up the length of some of the comments.
Comment #13
carinadigital commentedI think this is ready to go now.
Comment #14
tim.plunkettThe doxygen is still a little off, as per joachim's comments in #8.
However, the rest looks good, and you have been granted the ability to create full projects. Use this power sparingly and only when appropriate! Congratulations.