XF 2.1 Template issue really throwing me for a loop....


Well-known member
I am trying to add a tabbed system to my admin and followed a tutorial here on the site. However, I am running into a really weird issue that I don't know how to debug. Here is my listener code:


namespace HE\Core\Listener\Templater;

class MacroPreRender
    public static function extend(\XF\Template\Templater $templater, &$type, &$template, &$name, array &$arguments, array &$globalVars)
        if ($arguments['group']->group_id == 'testingGroup') {
            $template = 'he_testing_option_macros';
            $name = 'testing_option_form_block_tabs';

            $arguments['headers'] = [
                'generalOptions' => [
                    'label' => \XF::phrase('he_general'),
                    'minDisplayOrder' => 0,
                    'maxDisplayOrder' => 1000,
                    'active' => true
                'cleverOptions' => [
                    'label' => \XF::phrase('he_tab_1'),
                    'minDisplayOrder' => 1000,
                    'maxDisplayOrder' => 2000
                'classlinkOptions' => [
                    'label' => \XF::phrase('he_tab_2'),
                    'minDisplayOrder' => 2000,
                    'maxDisplayOrder' => 3000
                'googleClassroomOptions' => [
                    'label' => \XF::phrase('he_tab_3'),
                    'minDisplayOrder' => 3000,
                    'maxDisplayOrder' => -1

Here is the template code:
<xf:macro name="testing_option_form_block_tabs"
    arg-headers="{{ [] }}">
    <xf:if is="$options is not empty">
        <xf:form action="{{ link('options/update') }}" ajax="true" class="block">
            <div class="block-container">
                <h2 class="block-tabHeader tabs" data-xf-init="tabs" role="tablist">
                    <xf:foreach loop="$headers" key="$key" value="$header">
                        <a class="tabs-tab{{ $header.active ? ' is-active' : '' }}" role="tab" tabindex="0" aria-controls="{$key}">{$header.label}</a>

                <ul class="tabPanes">
                    <xf:foreach loop="$headers" key="$key" value="$header">
                        <li class="{{ $header.active ? 'is-active' : '' }}" role="tabpanel" id="{$key}">
                            <div class="block-body">
                                <xf:foreach loop="$options" value="$currentOption">
                                    <xf:if is="{$currentOption.Relations.{$group.group_id}.display_order} >= $header.minDisplayOrder AND ({$currentOption.Relations.{$group.group_id}.display_order} < $header.maxDisplayOrder OR $header.maxDisplayOrder == -1)">
                                        <xf:macro template="admin:option_macros"
                                            arg-option="{$currentOption}" />

                <xf:submitrow sticky="true" icon="save" />

Everything seems pretty straight forward but this is the output that I am getting:
Screen Shot 2020-07-20 at 4.52.21 PM.png

As you can see, it is trying to use the parent macro "testing_option_form_block_tabs" instead of the one specified, "option_row" from "option_macros". This has never happened during my development so I wanted to get a second set of eyes on this to point out something dumb that I am doing, lol.

Any help is appreciated, thanks.


Well-known member
Disregard this, I wasn't utilizing the proper event hint to help the listener render properly. All good now!