Fixed Less error when calling certain templates

Affected version


Well-known member
XF\CssRenderException: Error rendering template public:core_formrow.less: .m-formElementExplain is undefined in public:core_formrow.less (on or near line 3690) src/XF/CssRenderException.php:87
Generated by: Unknown account Jul 22, 2020 at 10:08 PM
Stack trace
 3687 |     .formRow-explain
 3688 |     {
 3689 |         margin: @_form-elementSpacer 0 0;
*3690*|         .m-formElementExplain();
 3691 |     }
 3692 | 
 3693 |     &.formRow--explainOffset .formRow-explain

#0 src/XF/CssRenderer.php(408): XF\CssRenderException::createFromLessException()
#1 src/XF/CssRenderer.php(342): XF\CssRenderer->renderToCss()
#2 src/XF/CssRenderer.php(250): XF\CssRenderer->renderTemplate()
#3 src/XF/CssRenderer.php(116): XF\CssRenderer->renderTemplate()
#4 src/XF/CssWriter.php(53): XF\CssRenderer->render()
#5 css.php(30): XF\CssWriter->run()
#6 {main}


Previous Less_Exception_Compiler: .m-formElementExplain is undefined in anonymous-file-0.less - src/vendor/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php:149
#0 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(147): Less_Tree_Mixin_Call->compile()
#1 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(88): Less_Tree_Ruleset->EvalMixinCalls()
#2 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(94): Less_Tree_Ruleset->compile()
#3 src/vendor/oyejorge/less.php/lib/Less/Tree/Ruleset.php(94): Less_Tree_Ruleset->compile()
#4 src/vendor/oyejorge/less.php/lib/Less/Parser.php(199): Less_Tree_Ruleset->compile()
#5 src/XF/CssRenderer.php(404): Less_Parser->getCss()
#6 src/XF/CssRenderer.php(342): XF\CssRenderer->renderToCss()
#7 src/XF/CssRenderer.php(250): XF\CssRenderer->renderTemplate()
#8 src/XF/CssRenderer.php(116): Xf\CssRenderer->renderTemplates()
#9 src/XF/CssWriter.php(53): XF\CssRenderer->render()
#10 css.php(30): XF\CssWriter->run()
#11 {main}

This does happen when calling certain less templates (like core_formrow.less ) containing mixins that are defined in other templates.


Well-known member
Thinking about this:
Im might be a good solution to have all mixins and variable definitions in one template that always gets implicitly included when rendering LESS.

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.0 Beta 3).

Change log:
Implement a system to allow special templates to be automatically prepended to certain template types to avoid server errors for undefined mixins in child templates when called individually without their parent.
There may be a delay before changes are rolled out to the XenForo Community.