I'm working on a new (drupal-powered) website for work and there's this page that lists upcoming music events in one of the venues. In this venue, we have a regular event that happens every wednesday. Thus, I need a comma-separated list of wednesdays. I don't want to add PHP to any input format besides the one where it's the only filter, so I needed some other way to get this content into my page (which also makes use of other filters, like img_assist, and insert view.)
The answer was to use the Insert Block module... but first I needed a module that produced the blocks I wanted. I worked from the nodeimageblock.module because it is simple and it was easy to chop out the pieces I wanted. I did however keep one theme method (even though, frankly, I don't need a div around the dates) because I wanted to leave myself an illustration of how it is done :) Besides, you can always change a div to display: inline
through CSS.
Attached is the wedsblock.module I produced. It has no options, and it presents two blocks. Insert it into the page by installing and enabling both it and the insert block module, then put the insert block filter into an applicable input format, and use [block:wedsblock] for the first block, and [block:wedsblock=1] for the second one. There's only two blocks, but it's trivial to add more because I use the $delta
(the number of the block provided by this module; the first is 0, the second is 1, etc) to specify the month. The delta can never be more than 12 (or was it 11?) without writing additional code - but you have to add more block statements to use more than a delta of 1, anyway.
Please don't ask for support; this module exists only as a code example to the rest of the world (and a key piece of functionality for my employer's site.)
As this module is based on nodeimageblock.module, it too is released under the GPL (version 2+).
Attachment | Size |
---|---|
wedsblock.tar.gz (7.53 KB) | 7.53 KB |