Add jquery to the javascript stack:
Stack::add( 'template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery' );
Add stylesheet to theme_stylesheet stack with media type
Stack::add( 'template_stylesheet', array( Site::get_url('theme') . '/style.css', 'screen' ), 'style' );
Output the javascript stack:
Stack::out( 'template_header_javascript', '' );
Output the theme_stylesheet stack:
Stack::out( 'template_stylesheet', '' );
Show file
Open project: habari/system
Method | Description | |
---|---|---|
action_register_stackitems ( ) | Register CSS and script that can be added to the Stacks. | |
add ( string $stack_name, mixed $value, string $value_name = null, string $after = null ) : array | Add a value to a stack | |
create_stack ( string $stack_name ) : array | Creates and retreives a named stack instance | |
dependent ( string $dependent, string $dependson ) | Make a stack's dependencies be provided by another stack | |
get ( string $stack_name, mixed $format = null ) | Returns all of the values of the stack | |
get_item ( string $stack_name, $value_name, mixed $default_value = null ) : mixed | Get a single item from a given stack. | |
get_named_stack ( string $stack_name ) : |
Retreive a named stack instance | |
get_sorted_stack ( $stack_name ) : array | Get the full list of StackItems in the correct order and with dependencies for a named stack | |
has ( string $stack_name, $value_name ) : boolean | Check for the existence of a given stack item. | |
load_stackitems ( ) | Allow plugins to register StackItems that can be added to Stacks later Initialize this class for plugin behavior so it can add system default StackItems | |
out ( string $stack_name, mixed $format = null ) | Outputs all of the values of the stack | |
remove ( string $stack_name, string $value_name = null ) : array | Remove a value to a stack | |
scripts ( string $element, mixed $attrib = null, string $wrapper = '%s' ) : string | A callback for Stack::get() that outputs scripts as reference or inline depending on their content | |
styles ( string $element, string $typename = null, string $props = [] ) : string | A callback for Stack::get() that outputs styles as link or inline style tags depending on their content |
Method | Description | |
---|---|---|
__construct ( mixed $input ) : array | Private constructor for Stack. | |
is_url ( string $url ) : boolean | Check if the passed string looks like a URL or an absolute path to a file. |
public static action_register_stackitems ( ) |
public static add ( string $stack_name, mixed $value, string $value_name = null, string $after = null ) : array | ||
$stack_name | string | The name of the stack |
$value | mixed | The value to add |
$value_name | string | The name of the value to add |
$after | string | The name of the stack element to insert this new element after |
return | array | The stack that was added to |
public static create_stack ( string $stack_name ) : array | ||
$stack_name | string | The name of the stack to create and return |
return | array | The created stack |
public static get_item ( string $stack_name, $value_name, mixed $default_value = null ) : mixed | ||
$stack_name | string | The name of the stack to fetch an item from. |
$default_value | mixed | The default value to return if the item does not exist in the stack. |
return | mixed | The item, or $default_value if it does not exist. |
public static get_named_stack ( string $stack_name ) : |
||
$stack_name | string | The name of the stack to return |
return | The requested stack |
public static get_sorted_stack ( $stack_name ) : array | ||
$stack_name | ||
return | array | A complete array of StackItems |
public static load_stackitems ( ) |