{"id":1699,"date":"2010-03-18T22:41:51","date_gmt":"2010-03-18T21:41:51","guid":{"rendered":"http:\/\/toki-woki.net\/blog\/?p=1699"},"modified":"2022-03-29T21:53:02","modified_gmt":"2022-03-29T20:53:02","slug":"shortcodes-for-drupal","status":"publish","type":"post","link":"https:\/\/toki-woki.net\/blog\/p1699-shortcodes-for-drupal","title":{"rendered":"Shortcodes for Drupal"},"content":{"rendered":"<p>WordPress&#8217; <a href=\"http:\/\/codex.wordpress.org\/Shortcode_API\">Shortcode API<\/a> is a really cool thing, and since I&#8217;m working on a Drupal site these days I&#8217;ve been looking for something similar. Unfortunately I couldn&#8217;t find anything&#8230; There are some implementations <a href=\"http:\/\/drupal.org\/project\/video_filter\">out there<\/a> but the ones I found and tested always come pre-bundled with specific tags and don&#8217;t always provide an extensible and stable logic.<\/p>\n<p>So I made mine!<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"size-full wp-image-1700 aligncenter\" title=\"Shortcodes for Drupal\" src=\"http:\/\/toki-woki.net\/blog\/wp-content\/uploads\/2010\/03\/shortcodes-drupal.gif\" alt=\"\" width=\"300\" height=\"370\" \/><\/p>\n<p><!--more-->Most of my work simply consisted in copying\/pasting the code in WordPress&#8217; <a href=\"http:\/\/core.trac.wordpress.org\/browser\/trunk\/wp-includes\/shortcodes.php\">shortcodes.php<\/a> and binding it into a Drupal filter. Easy enough.<\/p>\n<p>Now if you want to use it, you have to:<\/p>\n<ol>\n<li><a href=\"http:\/\/toki-woki.net\/blog\/wp-content\/uploads\/2010\/03\/shortcodes-0.1.zip\">Get the module<\/a><\/li>\n<li>Add it to your &#8220;modules&#8221; directory<\/li>\n<li>Enable it<\/li>\n<li>Add it to one of your setup&#8217;s filter bundle<\/li>\n<li>Write your own module where you&#8217;d implement one or more Shortcodes (<em>via<\/em> add_shortcode) and make sure you add &#8220;dependencies[] = shortcodes&#8221; in your .info file<\/li>\n<\/ol>\n<p>You might experience a nasty &#8220;Call to\u00a0undefined function\u00a0<em>add_shortcode<\/em>&#8220;. If so, you have to change you module implementation&#8217;s weight, either directly in your database, or thanks to the cool <a href=\"http:\/\/drupal.org\/project\/util\">Utility<\/a> module. Set it to 10 and you&#8217;re set!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress&#8217; Shortcode API is a really cool thing, and since I&#8217;m working on a Drupal site these days I&#8217;ve been looking for something similar. Unfortunately I couldn&#8217;t find anything&#8230; There are some implementations out there but the ones I found and tested always come pre-bundled with specific tags and don&#8217;t always provide an extensible and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[121,14,19,30,55,54,52],"acf":[],"_links":{"self":[{"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/posts\/1699"}],"collection":[{"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/comments?post=1699"}],"version-history":[{"count":22,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/posts\/1699\/revisions"}],"predecessor-version":[{"id":3006,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/posts\/1699\/revisions\/3006"}],"wp:attachment":[{"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/media?parent=1699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/categories?post=1699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/toki-woki.net\/blog\/wp-json\/wp\/v2\/tags?post=1699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}