but i can use this event? https://github.com/phpbb/phpbb/blob/mas ... y.php#L363JoshyPHP wrote: Thu Jul 13, 2017 10:46 pm Ideally there would be an event around the call to finalize() to retrieve the JavaScript parser at the same time the rest is generated. It would make things easier/more efficient.
Thank you.
Code: Select all
[mytag]{TEXT1}[/mytag]
Code: Select all
{TEXT1}
Code: Select all
class main_listener implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
return array(
'core.text_formatter_s9e_configure_after' => 'configure_usernamebbcode',
'core.text_formatter_s9e_render_before' => 'prepare_render_usernamebbcode',
);
}
public function configure_usernamebbcode($event)
{
// Get the BBCode configurator
$configurator = $event['configurator'];
// Let's unset any existing BBCode that might already exist
unset($configurator->BBCodes['user']);
unset($configurator->tags['user']);
// Let's create the new BBCode
$configurator->BBCodes->addCustom( '[mytag]{TEXT1}[/mytag]', '{TEXT1}');
}
public function prepare_render_usernamebbcode($event)
{
$renderer = $event['renderer']->get_renderer();
$username = $renderer->getParameter('TEXT1');
$userid = $this->user_loader->load_user_by_username($username);
$user = $this->user_loader->get_user($userid, true);
if ( $user == false or $user['username_clean'] == 'anonymous' )
{
$userbbcode = $username;
}
else
{
$userbbcode = $this->user_loader->get_username($userid, 'full', false, false, true);
}
$renderer->setParameter('TEXT1', $userbbcode);
}
}