Getting Started

By default, the global api variable for the theme engine is $theme. If this conflicts with an existing variable in your setup, you cna change the global variable in the module's config.

Usage in template & files

You will be able to use the engine to add, remove, sort and output CSS & JS files, for example you might specify the main assets in an array and add them to the styles array. All assets that you add to the Theme Engine's arrays will be able to be combined with ProCache or AllInOneMinify (AIOM+).

The following are the methods available for adding styles and scripts.

addStyle($stylePath)

// Example

$theme->addStyle('css/custom.css');

Adds a single css file to the engine's array of styles. This adds the file to the associative array of styles, and uses the file's basename as the key.

addStyles(array $assets)

// Example


$styles = array(
    // css files relative to templates root
);


$theme->addStyles($styles);

Add an array of CSS files to the module.

addScript($scriptPath, $location = 'foot');

// Example

$theme->addScript('js/custom.js');

// or if you want the js in the head:
$theme->addScript('js/custom.js','head');

Adds a single JS file.

addScripts(array $assets, $location = 'foot');

// Example

$scripts = array(
    // the array may be numeric keys or associative array
    // depends on if you will want to add, remove or reorder the assets, 
    // in which case it is better to use an asssociative array
);

$theme->addScripts($scripts);

Add an array of JS files. The items in the array should each represent a valid path to the file relative to the templates root folder.

addScriptExternal($scriptUrl);

// Example

$theme->addScriptExternal('https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js');

Adds a single external URL to the the external scripts array, which will be output to the headAssets() method.

Last updated