I want to use the helper into twing so i can load js and css files. So I did the following
in config file i have the following
/**
* The APIs to auto-load.
*/
'apis' => [
'APIHelper' => __DIR__ . '/app/api.php'
],
in the api.php I have the following
<?php
namespace MyApp;
/** @var \Herbert\Framework\API $api */
/**
* Gives you access to the Helper class from Twig
* {{ MyPlugin.helper('assetUrl', 'icon.png') }}
*/
$api->add('helper', function ()
{
$args = func_get_args();
$method = array_shift($args);
return forward_static_call_array(__NAMESPACE__ . '\\Helper::' . $method, $args);
});
and in the twig I'm doing the following but is null
<script src="{{ APIHelper.helper('assetUrl', 'moment.min.js') }}" type="text/javascript" charset="utf-8" async defer></script>
I want to use the helper into twing so i can load js and css files. So I did the following
in config file i have the following
in the api.php I have the following
and in the twig I'm doing the following but is null
<script src="{{ APIHelper.helper('assetUrl', 'moment.min.js') }}" type="text/javascript" charset="utf-8" async defer></script>
does anyone know why?