src/View/Helper/RequireHelper.php
public function module($name)
    {
        list($plugin, $path) = $this->_View->pluginSplit($name, false);
        if (!empty($plugin)) {
            $name = $this->Url->assetUrl($name, [
                'pathPrefix' => Configure::read('App.jsBaseUrl'),
                'ext' => '.js',
            ]);
        }
        if (!$this->_requireLoaded) {
            return $this->_preLoadModule($name);
        }
        return $this->_loadModule($name);
    }
public function module($name)
    {
        list($plugin, $path) = $this->_View->pluginSplit($name, false);
        if (!empty($plugin)) {
            $name = $this->Url->assetUrl($name, [
                'pathPrefix' => Configure::read('App.jsBaseUrl'),
                'ext' => '.js',
            ]);
        }
        if (!$this->_requireLoaded) {
            return $this->_preLoadModule($name);
        }
        return $this->_loadModule($name);
    }
public function module ( $ name ) { list ( $ plugin , $ path ) = $ this -> _View -> pluginSplit ( $ name , false ) ; if ( ! empty ( $ plugin ) ) { $ name = $ this -> Url -> assetUrl ( $ name , [ 'pathPrefix' => Configure :: read ( 'App.jsBaseUrl' ) , 'ext' => '.js' , ] ) ; } if ( ! $ this -> _requireLoaded ) { return $ this -> _preLoadModule ( $ name ) ; } return $ this -> _loadModule ( $ name ) ; }
Add a javascript module to be loaded on the page.

Every module that is called prior to the load() command should be pre-loaded
and will be outputted along with the loader.

Every module that comes after the loader, for example via ajax, should
be loaded right away by setting the "preLoad" option to false

@param string $name name of the js module to load
@return void|string loader tag is outputted on post-load
Add a javascript module to be loaded on the page .