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.
This is the code documentation for the SproutCMS project
Search documentation |
class NeedsProvides 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.
Extending this class<?php
/**
* New class description goes here
*
* @author Your Name, 2026-08-16
**/
class NewClassName extends Needs {
/**
* Adds a JS include need.
**/
public function addJavascriptInclude (string $url, array $extra_attrs, $key) {
// Method code goes here
}
/**
* 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 function fileGroup (string $name) {
// Method code goes here
}
/**
* Adds a generic need.
* If a key is specified, the need is added with that key
* allowing for updating of the need later.
**/
public function addNeed (string $need, $key) {
// Method code goes here
}
/**
* Removes a module
*
* e.g. Needs::fileGroup('facebox') can be removed with Needs::removeModule('facebox')
**/
public function removeModule ($key) {
// Method code goes here
}
/**
* Adds a CSS include need.
**/
public function addCssInclude (string $url, array $extra_attrs, $key) {
// Method code goes here
}
}
?>
|
| Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Wednesday, 5th August, 2026 at 03:31 pm |
|