Quote from: Electronics StackExchange (comment score: 3)You get a body diode whether you want it or not.
function hook_my_bbcode(&$codes, &$no_autolink_tags) {
// $no_autolink_tags is an array of tags that shouldn't have their
// content automatically turn into links. we'll be ignoring that
// here.
$codes[] = array(
// the tag will be [box][/box]
'tag' => 'box',
// more on this in a moment!
'type' => 'unparsed_content',
// $1 is the content between the tags
'content' => '<div style="border: 1px solid white;">$1</div>',
// Provide a function to transform the content the user entered.
// For example, [noguest] uses this to hide text from guests.
'validate' => function(&$tag, &$data, $disabled, $params)
{
// If the user didn't provide content, provide it for them :)
if (empty($data)) {
$data = "im in the box!";
}
},
// yes this is a block element
'block_level' => true,
);
}
type: one of...
- (missing): [tag]parsed content[/tag]
- unparsed_equals: [tag=xyz]parsed content[/tag]
- parsed_equals: [tag=parsed data]parsed content[/tag]
- unparsed_content: [tag]unparsed content[/tag]
- closed: [tag], [tag/], [tag /]
- unparsed_commas: [tag=1,2,3]parsed content[/tag]
- unparsed_commas_content: [tag=1,2,3]unparsed content[/tag]
- unparsed_equals_content: [tag=...]unparsed content[/tag]
$codes[] = array(
// the tag will be [box][/box]
'tag' => 'box',
// what to add before the content
'before' => '<div style="border: 1px solid white;">',
// what to add after the content
'after' => '</div>',
'block_level' => true,
);