2

Implementation of Wordpress like shortcodes using fitlers - Problem with drupal_add_js, drupal_add_css and drupal_add_library

http://drupal.org

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 more

Read »
Created by Dplanet 1 year 38 weeks ago
Category: Modules   Tags:

PSD to Drupal Theme

Drupal Development

Module Development

Get an Estimate

Best published scoops - Modules

Tags for Implementation of Wordpress like shortcodes using fitlers - Problem with drupal_add_js, drupal_add_css and drupal_add_library

Recent comments