Cannot call parent?

Floren

Well-known member
Hi guys,

I'm extending the XenForo_BbCode_Formatter_Base (set as hint), by adding the callback into XenResource/Listener/Proxy.php:
Code:
        public static function loadBaseFormatter($class, array &$extend)
        {
                $extend[] = 'XenResource_Listener_Proxy_FormatterBase';
        }
And XenResource/Listener/Proxy/FormatterBase.php:
Code:
class XenResource_Listener_Proxy_FormatterBase extends XFCP_XenResource_Listener_Proxy_FormatterBase
{
        public function renderTagCode(array $tag, array $rendererStates)
        {
                switch (strtolower(strval($tag['option'])))
                {
                        case 'alt':
                                return $this->renderTagAltCode($tag, $rendererStates);
                }

               return parent::renderTagCode($tag, $rendererStates);
        }

        public function renderTagAltCode(array $tag, array $rendererStates)
        {
                $content = $this->renderSubTree($tag['children'], $rendererStates);

                if ($this->_view)
                {
                        $template = $this->_view->createTemplateObject('bb_code_tag_alt_code', array(
                                'content' => $content
                        ));
                        return $template->render();
                }
                else
                {
                        return $this->_wrapInHtml('<pre style="margin: 1em auto" title="Code">', '</pre>', $content);
                }
        }
}
I get an error: unexpected ':', is the parent::renderTagCode part. What am I doing wrong?
I don't want to re-create the entire function but rather load the parent for the rest of code execution.
 
Last edited:
Never mind heh, is parent::renderTagCode, not parent:renderTagCode.
I fixed the typo above... :giggle:
 
Top Bottom