Lack of interest Code event listener for overriding phrase params before rendering

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.
This suggestion has been closed. Votes are no longer accepted.
You can extend the XF\Language class an then override the renderPhrase function.
Here's an example how to remove vowels from a phrase:
PHP:
<?php

namespace My\Addon\XF;

class Language extends XFCP_Language
{
    public function renderPhrase($name, array $params = [], $context = 'html', array $options = [])
    {
        $phrase = parent::renderPhrase($name, $params, $context, $options);
        $filters = [ 'A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u' ];
        return str_replace($filters, '', $phrase);
    }
}
 
Yeah, @TickTackk is fully aware that this is possible and and his suggestion was to a add code event to avoid having to build a full class extension.
Oh, I see.
Something like an event called phrase_pre_render and phrase_post_render that can be fired when \XF::Language::renderPhrase() is called, right?
 
Back
Top Bottom