Tabbed Options

Tabbed Options

when i try to achieve it i get this error :(
can you guide me little bit ?

An exception occurred: [TypeError] Argument 5 passed to xenbros\Super\EventListener\MacroRender::preRender() must be of the type array, string given in src\addons\xenbros\Super\EventListener\MacroRender.php on line 7

and line 7 is =

public static function preRender(\XF\Template\Templater $templater, &$type, &$template, &$name, array &$arguments, array &$globalVars)
 
Does this code still work? I seem to be running into issues with OPTIONS not being passed properly to the macro.
 
Thanks for this awesome guide! Works like a charm and makes the settings much more intuitive to use :)

One thing one of my testers noticed.

The tabbed interface works fine when accessed through: ACP > Setup > Options > Addon name

If accessed through ACP > Add-ons > Addon name (gear icon) > Options it will render the page without any tabs/headers.
- I'm thinking maybe there is some different event listener that would need to be used here?
 
Thanks for this awesome guide! Works like a charm and makes the settings much more intuitive to use :)

One thing one of my testers noticed.

The tabbed interface works fine when accessed through: ACP > Setup > Options > Addon name

If accessed through ACP > Add-ons > Addon name (gear icon) > Options it will render the page without any tabs/headers.
- I'm thinking maybe there is some different event listener that would need to be used here?
It seems to work for me 🤔 Are you using XF 2.0, 2.1 or 2.2?
 
The tabbed interface works fine when accessed through: ACP > Setup > Options > Addon name

If accessed through ACP > Add-ons > Addon name (gear icon) > Options it will render the page without any tabs/headers.
I can confirm this behavior.


Also, when I go to Setup > Advertising I get this error on screen:

Screenshot 2021-06-19 at 12.07.15.webp
(I get it for all my add-ons that use this tabbed options code)


Here's is more from that server error:

Code:
Stack trace

#0 src/addons/BassMan/ThreadSnippet/MacroRender.php(9): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Att...', '/home/customize...', 9)
#1 [internal function]: BassMan\ThreadSnippet\MacroRender::preRender(Object(XF\Template\Templater), 'admin', 'option_macros', 'option_form_blo...', Array, Array)
#2 src/XF/Extension.php(50): call_user_func_array(Array, Array)
#3 src/XF/App.php(2834): XF\Extension->fire('templater_macro...', Array, 'admin:option_ma...')
#4 src/XF/Template/Templater.php(738): XF\App->fire('templater_macro...', Array, 'admin:option_ma...')
#5 internal_data/code_cache/templates/l1/s0/admin/advertising_list.php(98): XF\Template\Templater->callMacro('option_macros', 'option_form_blo...', Array, Array)
#6 src/XF/Template/Templater.php(1628): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#7 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('advertising_lis...', Array)
#8 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#9 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Advertising\\...', 'admin:advertisi...', Array)
#10 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#13 src/XF/App.php(2337): XF\Mvc\Dispatcher->run()
#14 src/XF.php(488): XF\App->run()
#15 admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}

Not sure when this started to happen, but this wasn't like that before and it is showing an error for all my add-ons that use this tabbed options. I'm running the latest XF version 2.2.5. Any help appreciated @DragonByte Tech.
 
Oh, after I posted this I've seen that the approach for tabbed options is changed (that MacroRender.php file is different after the last update). I'll try to change this first and come back with news...
 
Ok, I've changed everything to the latest version of this tweak, but I'm still getting the above server error.
 
I can confirm this behavior.


Also, when I go to Setup > Advertising I get this error on screen:

View attachment 253570
(I get it for all my add-ons that use this tabbed options code)


Here's is more from that server error:

Code:
Stack trace

#0 src/addons/BassMan/ThreadSnippet/MacroRender.php(9): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Att...', '/home/customize...', 9)
#1 [internal function]: BassMan\ThreadSnippet\MacroRender::preRender(Object(XF\Template\Templater), 'admin', 'option_macros', 'option_form_blo...', Array, Array)
#2 src/XF/Extension.php(50): call_user_func_array(Array, Array)
#3 src/XF/App.php(2834): XF\Extension->fire('templater_macro...', Array, 'admin:option_ma...')
#4 src/XF/Template/Templater.php(738): XF\App->fire('templater_macro...', Array, 'admin:option_ma...')
#5 internal_data/code_cache/templates/l1/s0/admin/advertising_list.php(98): XF\Template\Templater->callMacro('option_macros', 'option_form_blo...', Array, Array)
#6 src/XF/Template/Templater.php(1628): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#7 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('advertising_lis...', Array)
#8 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#9 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Advertising\\...', 'admin:advertisi...', Array)
#10 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#13 src/XF/App.php(2337): XF\Mvc\Dispatcher->run()
#14 src/XF.php(488): XF\App->run()
#15 admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}

Not sure when this started to happen, but this wasn't like that before and it is showing an error for all my add-ons that use this tabbed options. I'm running the latest XF version 2.2.5. Any help appreciated @DragonByte Tech.
Sounds like an add-on conflict. Try disabling all add-ons other than the ThreadSnippet add-on.
 
Sounds like an add-on conflict. Try disabling all add-ons other than the ThreadSnippet add-on.
Actually, it's enough to disable that code event listener for tabbed options and the server error goes away. That's why I assume it must be something with this.

Btw, this error also happens when visiting Notices in ACP.

Maybe it's a XenForo bug.
 
Actually, it's enough to disable that code event listener for tabbed options and the server error goes away. That's why I assume it must be something with this.

Btw, this error also happens when visiting Notices in ACP.

Maybe it's a XenForo bug.
Can you please try disabling all other add-ons? I am aware the error goes away when you disable the known component of an add-on conflict, but it would be helpful to find the unknown one.

Otherwise, I could say "the issue doesn't exist because it doesn't happen to me" :P
 
Try disabling all add-ons other than the ThreadSnippet add-on.
Ok, I've done that and I get the same error for this add-on. If I disable code event listener for tabbed options and the server error goes away.

Not sure what could be wrong with Listener.php file, because it is the same as yours.
 
UPDATE:
just for a test, I've created a test addon from scratch only with this PHP file (no other templates or any kind of code added to this add-on) and I get the same error for this add-on.
 
Ok, I've done that and I get the same error for this add-on. If I disable code event listener for tabbed options and the server error goes away.

Not sure what could be wrong with Listener.php file, because it is the same as yours.
So as it turns out, I'm just blind, because I didn't fully parse the error message you posted; I can confirm the issue on the admin.php?advertising/ page 🤦‍♂️

The fix is to change the first line of the listener code to if (!empty($arguments['group']) && $arguments['group']->group_id == 'XXXX').

Guess I'm releasing 7 updates tomorrow... 😭
 
So as it turns out, I'm just blind, because I didn't fully parse the error message you posted; I can confirm the issue on the admin.php?advertising/ page 🤦‍♂️

The fix is to change the first line of the listener code to if (!empty($arguments['group']) && $arguments['group']->group_id == 'XXXX').

Guess I'm releasing 7 updates tomorrow... 😭
Yep, that was it. Works fine now.

Thank you for the fix.
 
Top Bottom