SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class Needs

Provides a system for injecting CSS and Javascript includes into the head of a document even after the head has been outputted.
Also does replacement for the string "SITE/", which gets changed into the Kohana root directory.

Variables

NameVisibilityDescription
$needs (static) 

Functions

NameVisibilityDescription
addCssIncludepublic (static)Adds a CSS include need.
addJavascriptIncludepublic (static)Adds a JS include need.
addNeedpublic (static)Adds a generic need.
fileGrouppublic (static)Loads a specific file group.
removeModulepublic (static)Removes a module

public addCssInclude

void Needs::addCssInclude ( string $url [, array $extra_attrs [, mixed $key ]] );

Adds a CSS include need.

public addJavascriptInclude

void Needs::addJavascriptInclude ( string $url [, array $extra_attrs [, mixed $key ]] );

Adds a JS include need.

public addNeed

void Needs::addNeed ( string $need [, mixed $key ] );

Adds a generic need.
If a key is specified, the need is added with that key
allowing for updating of the need later.

public fileGroup

void Needs::fileGroup ( string $name );

Loads a specific file group.
The files in a group are JS and CSS files with matching names, e.g. file.js and file.css
The JS files can be minified, so 'file' will match file.min.js; minified files take precedence.

The group can be:
1. a straight file basename e.g. 'my_file', or
2. sprout plus a file basename, e.g. 'sprout/my_file', or
3. a module name plus a file basename, e.g. 'MyModule/my_file'

The files must be in the 'media/(js/css)/' directory beneath the relevant path.
As per the following exaples:

If the group name 'fb' is requested, the following two files will be included, if they are found:
- media/css/fb.css
- media/js/fb.min.js OR media/js/fb.js

If 'sprout/admin_layout' is requested, the following two files will be included, if they are found:
- sprout/media/css/admin_layout.css
- sprout/media/js/admin_layout.min.js OR sprout/media/js/admin_layout.js

If 'Users/users' is requested, the following two files will be included, if found:
- modules/Users/media/css/users.css
- modules/Users/media/js/users.min.js OR modules/Users/media/js/users.js

public removeModule

void Needs::removeModule ( mixed $key );

Removes a module

e.g. Needs::fileGroup('facebox') can be removed with Needs::removeModule('facebox')