3
<?php

class XenForo_Template_Compiler_Tag_Title implements XenForo_Template_Compiler_Tag_Interface
{

    public function compile(XenForo_Template_Compiler $compiler, $tag, array $attributes, array $children, array $options)
    {
        if (empty($options['allowRawStatements']))
        {
            throw $compiler->getNewCompilerException(new XenForo_Phrase('x_tags_only_used_where_full_statements_allowed', array('tag' => 'title')));
        }

        $var = '__extraData[\'title\']';
        $childOutput = $compiler->compileIntoVariable($children, $var, $options, false);

        return $compiler->getNewRawStatement($childOutput);
    }
}

Above code is taken from library\XenForo\Template\Compiler\Tag\Title.php. I am trying to understand how it works. eg. <xen:title>Page Title</xen:title>, so what are $compiler, $tag, $attributes, $children, $options?

Charles
  • 50,943
  • 13
  • 104
  • 142
user2243528
  • 425
  • 1
  • 3
  • 9
  • You might have better luck asking this over on their forums. If they're following the tradition we started with the UBB, they'll also surely have an unofficial code modification site that could help you out... If not, it'd be pretty interesting if the community wanted to chose SO. – Charles Apr 26 '13 at 16:19
  • 1
    @Charles Addon discussions are now on the official forums. – tyteen4a03 Jun 09 '13 at 19:02

1 Answers1

1

I'll let XenForo/Template/Compiler speak for itself:

/**
* Compile a tag segment. Mostly handled by the specified tag handler.
*
* @param string Tag found
* @param array  Attributes (key: name, value: value)
* @param array  Any nodes (text, var, tag) that are within this tag
* @param array  Options
*/

As for options:

/**
 * Default options for compilation. These will be used if individual handles do not
 * override them. Handlers may override all of them or individual ones.
 *
 * @var array
 */
tyteen4a03
  • 1,812
  • 24
  • 45