I am working on converting my SMF Indent BBC mod to ElkArte addon but could not make it working. I am posting the code below.
From the subs file:
function IndentBBC(&$codes)
{
// Add bbc code(s)
$codes[] = array(
'tag' => 'indent',
'before' => '<div style="margin: 0 3%;">',
'after' => '</div>',
'block_level' => true
);
$codes[] = array(
'tag' => 'left-indent',
'before' => '<div style="margin-left: 3%;">',
'after' => '</div>',
'block_level' => true
);
$codes[] = array(
'tag' => 'right-indent',
'before' => '<div style="margin-right: 3%;">',
'after' => '</div>',
'block_level' => true
);
}
function IndentBBC_Buttons(&$bbc_tags)
{
global $txt, $context;
// Load language(s)
loadLanguage('IndentBBC');
// Add bbc button(s)
$context['bbc_tags'][] = array(
array(
'image' => 'IndentFullBBC',
'code' => 'indent',
'before' => '[indent]',
'after' => '[/indent]',
'description' => $txt['indent']
),
array(
'image' => 'IndentLeftBBC',
'code' => 'left-indent',
'before' => '[left-indent]',
'after' => '[/left-indent]',
'description' => $txt['left-indent']
),
array(
'image' => 'IndentRightBBC',
'code' => 'right-indent',
'before' => '[right-indent]',
'after' => '[/right-indent]',
'description' => $txt['right-indent']
),
);
}
From the hook file:
$hook_functions = array(
'integrate_bbc_codes' => 'IndentBBC|SOURCEDIR/addons/QRR.subs.php',
'integrate_bbc_buttons' => 'IndentBBC_Buttons|SOURCEDIR/addons/QRR.subs.php',
);
Full package is also attached. If anybody spotted any reason why it is not wokring, do post them here.
At least the hooks seem to be wrong .. The File with the functions is named IndentBBC.subs.php but the hook is looking for addon/QRR.subs.php
Thank you
@TE. Fixed that but the code is still not working. What is wrong this time. Hurmmm... ::)
Package is attached for further analysis.
You are going to find that adding buttons to the editor is a bit more involved with sceditor. I'd suggest as a start to take a look at the move bbc addon that I put together, I think it will get you started with how to interface with the editor. http://addons.elkarte.net/bbc/BBC-Move.html
The hook you have to add the codes to parse_bbc look fine, its the hook to add buttons to the editor and then tell the editor what to do in both wizzy and source modes thats a bit more involved these days.
Thank you
@Spuds. I will check and test that soon and update.
Oh my god... I haven't this before? Lol...