Hello everyone!
Ive been working on a module that implements shortcode functionality (like in wordpress) to replace shortcode tags with html code and do other fancy things...
The module uses the Drupal Filter API to implement a Filter which than can be used by other modules to add custom shortcode tags. For example a second module could use hook_shortcode_info() to add, let's say, a jQuery shortcode like [accordion id="accordion-div" /] which would then be replaced by the filter and the javascript would be added by drupal_add_library('system', 'ui.accordion');.
This all works very well: The shortcode is found by the regex and the callback function for the shortcode is being called with all the information it needs (attributes, tag name and so on). Just replacing the tag with html is no problem at all, the problem begins when I also want to add css, javascript, or libraries.
Read »








