public function onReplaceInsertTags(string $tag, bool $useCache, $cacheValue, array $flags)
    {
        static $supportedTags = [
            'faq',
            'faq_open',
            'faq_url',
            'faq_title',
        ];

        $elements = explode('::', $tag);
        $key = strtolower($elements[0]);

        if (!\in_array($key, $supportedTags, true)) {
            return false;
        }

        $this->framework->initialize();

        /** @var FaqModel $adapter */
        $adapter = $this->framework->getAdapter(FaqModel::class);

        $faq = $adapter->findByIdOrAlias($elements[1]);

        if (null === $faq || false === ($url = $this->generateUrl($faq, \in_array('absolute', $flags, true)))) {
            return '';
        }

        return $this->generateReplacement($faq, $key, $url);
    }
public function onReplaceInsertTags(string $tag, bool $useCache, $cacheValue, array $flags)
    {
        static $supportedTags = [
            'faq',
            'faq_open',
            'faq_url',
            'faq_title',
        ];

        $elements = explode('::', $tag);
        $key = strtolower($elements[0]);

        if (!\in_array($key, $supportedTags, true)) {
            return false;
        }

        $this->framework->initialize();

        
        $adapter = $this->framework->getAdapter(FaqModel::class);

        $faq = $adapter->findByIdOrAlias($elements[1]);

        if (null === $faq || false === ($url = $this->generateUrl($faq, \in_array('absolute', $flags, true)))) {
            return '';
        }

        return $this->generateReplacement($faq, $key, $url);
    }
public function onReplaceInsertTags ( string $ tag , bool $ useCache , $ cacheValue , array $ flags ) { static $ supportedTags = [ 'faq' , 'faq_open' , 'faq_url' , 'faq_title' , ] ; $ elements = explode ( '::' , $ tag ) ; $ key = strtolower ( $ elements [ 0 ] ) ; if ( ! \ in_array ( $ key , $ supportedTags , true ) ) { return false ; } $ this -> framework -> initialize ( ) ; /** @var FaqModel $adapter */ $ adapter = $ this -> framework -> getAdapter ( FaqModel :: class ) ; $ faq = $ adapter -> findByIdOrAlias ( $ elements [ 1 ] ) ; if ( null === $ faq || false === ( $ url = $ this -> generateUrl ( $ faq , \ in_array ( 'absolute' , $ flags , true ) ) ) ) { return '' ; } return $ this -> generateReplacement ( $ faq , $ key , $ url ) ; }
Replaces the FAQ insert tags.

@return string|false
Replaces the FAQ insert tags .