Scripts
extends AbstractEnq
in package
Table of Contents
- CORE_CSS = 'brisko-core'
- Theme Base css.
- $css_files : mixed
- $style_files : mixed
- custom_css() : mixed
- Custom Theme styles.
- editor_style() : void
- Setup a style based on mod.
- enqueue() : mixed
- Enqueue scripts.
- enqueue_script() : void
- Setup a style mod.
- enqueue_style() : void
- Setup a style based on mod.
- enqueue_user_assets() : mixed
- get_style_files() : mixed
- init() : void
- Initialize instance.
- register() : mixed
- Register scripts.
- setup_theme_editor_styles() : mixed
- element_mod() : string
- Get element space padding or margin.
- maybe() : bool
- Check if the 'brisko_elements_loaded' action has been executed.
- register_script() : void
- Register a new script.
- sanitize_css() : string
- Sanitize CSS.
- set_css_files() : mixed
- style_files() : array<string|int, mixed>
- Setup static CSS files.
Constants
CORE_CSS
Theme Base css.
public
mixed
CORE_CSS
= 'brisko-core'
Properties
$css_files
protected
mixed
$css_files
$style_files
protected
mixed
$style_files
Methods
custom_css()
Custom Theme styles.
public
custom_css() : mixed
Return values
mixed —editor_style()
Setup a style based on mod.
public
editor_style(string $asset, string $mod[, bool $default = false ]) : void
Parameters
- $asset : string
-
the registered style name
- $mod : string
-
the theme_mod name example 'enable_bootstrap'
- $default : bool = false
-
true|false if this should be enabled by default.
Return values
void —enqueue()
Enqueue scripts.
public
enqueue() : mixed
Return values
mixed —enqueue_script()
Setup a style mod.
public
static enqueue_script(string $handle, string $mod[, bool $default = false ]) : void
Parameters
- $handle : string
-
the enqueue handle example 'bootstrap'
- $mod : string
-
the theme_mod name example 'enable_bootstrap'
- $default : bool = false
-
true|false if this should be enabled by default.
Return values
void —enqueue_style()
Setup a style based on mod.
public
static enqueue_style(string $handle, false|string $mod[, bool $default = false ]) : void
Parameters
- $handle : string
-
the enqueue handle example 'bootstrap'
- $mod : false|string
-
the theme_mod name example 'enable_bootstrap', use false to override
- $default : bool = false
-
true|false if this should be enabled by default.
Return values
void —enqueue_user_assets()
public
enqueue_user_assets() : mixed
Return values
mixed —get_style_files()
public
get_style_files([string $style = '' ]) : mixed
Parameters
- $style : string = ''
Return values
mixed —init()
Initialize instance.
public
init() : void
Return values
void —register()
Register scripts.
public
register() : mixed
Return values
mixed —setup_theme_editor_styles()
public
setup_theme_editor_styles() : mixed
Return values
mixed —element_mod()
Get element space padding or margin.
protected
element_mod([string $theme_mod = 'footer_padding' ][, string $default = '16px' ]) : string
Parameters
- $theme_mod : string = 'footer_padding'
-
.
- $default : string = '16px'
-
.
Return values
string —.
maybe()
Check if the 'brisko_elements_loaded' action has been executed.
protected
static maybe() : bool
Determine whether to load theme modifications by default.
This method checks if the 'brisko_elements_loaded' action has been executed. If the action has not been fired, it indicates that the Brisko Elements plugin is not active. In this case, we need to load certain theme modifications like theme styles by default. However, if the action has been fired, it means the plugin is active and can control theme mods, so we return false to prevent default loading.
Return values
bool —Returns true if the 'brisko_elements_loaded' action has NOT been executed, indicating the need to load theme modifications by default. Returns false if the action has been fired, indicating that the plugin can control theme mods, and we should not load them by default.
register_script()
Register a new script.
protected
static register_script(string $handle, string $src[, array<string|int, mixed> $deps = [] ][, bool $in_footer = true ]) : void
Parameters
- $handle : string
-
Name of the script. Should be unique.
- $src : string
-
path of the script relative to the Theme directory.
- $deps : array<string|int, mixed> = []
-
An array of registered script handles this script depends on.
- $in_footer : bool = true
-
Whether to enqueue the script before