src/Common/Controller/Base.php
public static function setNailsJs()
    {
        $oAsset     = Factory::service('Asset');
        $aVariables = [
            'ENVIRONMENT' => Environment::get(),
            'SITE_URL'    => site_url('', Functions::isPageSecure()),
            'NAILS'       => (object) [
                'URL'  => NAILS_ASSETS_URL,
                'LANG' => (object) [],
                'USER' => (object) [
                    'ID'    => activeUser('id') ? activeUser('id') : null,
                    'FNAME' => activeUser('first_name'),
                    'LNAME' => activeUser('last_name'),
                    'EMAIL' => activeUser('email'),
                ],
            ],
        ];
        foreach ($aVariables as $sKey => $mValue) {
            $oAsset->inline('window.' . $sKey . ' = ' . json_encode($mValue) . ';', 'JS', 'HEADER');
        }
    }
public static function setNailsJs()
    {
        $oAsset     = Factory::service('Asset');
        $aVariables = [
            'ENVIRONMENT' => Environment::get(),
            'SITE_URL'    => site_url('', Functions::isPageSecure()),
            'NAILS'       => (object) [
                'URL'  => NAILS_ASSETS_URL,
                'LANG' => (object) [],
                'USER' => (object) [
                    'ID'    => activeUser('id') ? activeUser('id') : null,
                    'FNAME' => activeUser('first_name'),
                    'LNAME' => activeUser('last_name'),
                    'EMAIL' => activeUser('email'),
                ],
            ],
        ];
        foreach ($aVariables as $sKey => $mValue) {
            $oAsset->inline('window.' . $sKey . ' = ' . json_encode($mValue) . ';', 'JS', 'HEADER');
        }
    }
public static function setNailsJs ( ) { $ oAsset = Factory :: service ( 'Asset' ) ; $ aVariables = [ 'ENVIRONMENT' => Environment :: get ( ) , 'SITE_URL' => site_url ( '' , Functions :: isPageSecure ( ) ) , 'NAILS' => ( object ) [ 'URL' => NAILS_ASSETS_URL , 'LANG' => ( object ) [ ] , 'USER' => ( object ) [ 'ID' => activeUser ( 'id' ) ? activeUser ( 'id' ) : null , 'FNAME' => activeUser ( 'first_name' ) , 'LNAME' => activeUser ( 'last_name' ) , 'EMAIL' => activeUser ( 'email' ) , ] , ] , ] ; foreach ( $ aVariables as $ sKey => $ mValue ) { $ oAsset -> inline ( 'window.' . $ sKey . ' = ' . json_encode ( $ mValue ) . ';' , 'JS' , 'HEADER' ) ; } }
Sets a global Nails JS object

@throws \Nails\Common\Exception\FactoryException
Sets a global Nails JS object