Closed (fixed)
Project:
Extensible BBCode
Version:
8.x-3.x-dev
Component:
Default tags
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2012 at 18:28 UTC
Updated:
30 Sep 2016 at 10:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
cburschkaThis looks great! Pity that it will require unconditionally loading collapse.js once it's in, but that's not much overhead.
Just make the label translatable, and this is good to go.
(Also, code style: The markup doesn't really need linebreaks here. The other tags in xbbcode_basic also have all their markup in one line.)
If you can, could you upload the finished version as a patch? The tag would probably fit best just after the "definition" tag as it is a text object.
Comment #1.0
cburschkaminor text revision
Comment #2
cburschkaComment #3
cburschkaMaybe bring this back after all, now that assets can be conditionally loaded.
Comment #4
cburschkaAnnoyingly, I can't tell whether the "attached" thing actually works, because it looks like collapse.js is being loaded either way. Since the bbcode tag only returns HTML, I have no idea if the libraries attached to the rendered "Details" element have any way of bubbling up via some spooky side effect.
I'll leave them in on the grounds that it can't hurt, and it might be needed to ensure the library remains attached if the filter output is cached.
Comment #6
cburschkaComment #8
cburschkaComment #12
Dylan A commentedI've made a little port for Drupal 7.
In xbbcode_basic/xbbcode_basic.module, add somewhere in the function xbbcode_basic_xbbcode_info:
$tags['spoiler'] = array(
'callback' => 'xbbcode_basic_render_spoiler',
'markup' => '
Spoiler
',
'description' => t('Hidden text'),
'sample' => t('[spoiler]Text[/spoiler]'),
);
And add the following function:
function xbbcode_basic_render_spoiler($tag) {
drupal_add_js('misc/collapse.js');
}