Block API module - Drupal
Block API is a new module I have developed for Drupal 6 which gives greater control over block templates much like you do with nodes. With nodes, contributed modules can define new content types which users can create notes from which are set templates. The Block API allows new contributed modules to do the same by defining a type of block. The core block module allows a user to enter any data they want in to a textarea. This could be some PHP code or HTML code which they copied from another service to display a widget on their page. Some modules already do this such as menu_block which allows you to create a block based on one of the pre-existing menus which you then have further control over. But this adds an extra "Add block" button to the block page. The idea behind Block API is that these modules can hook in to Block API and be used through the same "Add block button" as seen in this screenshot, where Add module block allows you to add a custom block.
The user can then select the block type from the following screen:
Examples of possible modules include:
- Twitter stream - Rather than pasting in some PHP or HTML + JS, the user would be able to create a Block of the Twitter stream type and set the parameters to use in the Twitter stream.
- Scrolling list of text - A vertical scrolling list of text, like a marquee, rather than adding JS and the HTML, the JS can be implemented by the module allowing the user to just type in the text they want to appear in the list.
Block API is available to download on Drupal.org Developers can find out more information on hooking in to the Block API here. List of modules using Block API.