Cylon
Member
Dear friends,
I'm injecting some js files using a code event listener. Concretely, I'm using the templater_setup event, and the callback for this event receives following parameters:
\XF\Container $container, \XF\Template\Templater &$templater
What I'm doing inside my event listener is the following:
	
	
	
		
This does not work very well. Maybe you know another way to distinguish if we are rendering the frontend / dashboard to inject some custom scripts.
Thanks!
http://localhost:8080/admin.php?code-events/listeners/templater_template_post_render.34/delete
				
			I'm injecting some js files using a code event listener. Concretely, I'm using the templater_setup event, and the callback for this event receives following parameters:
\XF\Container $container, \XF\Template\Templater &$templater
What I'm doing inside my event listener is the following:
		PHP:
	
	if ( $container->getOriginal( "app.classType" ) === "Admin" ) { //Skip if we are rendering a template in the dashboard, because the files are not needed
   return;
}
$templater->includeJs( [ 'src' => 'myjavascript.js, 'min' => true ] );This does not work very well. Maybe you know another way to distinguish if we are rendering the frontend / dashboard to inject some custom scripts.
Thanks!
http://localhost:8080/admin.php?code-events/listeners/templater_template_post_render.34/delete
 
 
		 
 
		
 
 
		