LLMS_Assets::get( string $type, string $handle )
Retrieve an asset definition by type and handle
Description Description
Locates the asset by type and handle and merges a potentially impartial asset definition with default values from the get_defaults()
method.
Parameters Parameters
- $type
-
(Required) The asset type. Accepts either "script" or "style".
- $handle
-
(Required) The asset handle.
Return Return
(array|false) An asset definition array or false
if an asset definition could not be located.
- 'file_name'
(string) The file name of the asset. Excludes the path, suffix, and extension, eg: 'llms' for 'llms.js'. Defaults to the asset's handle. - 'base_url'
(string) The base URL used to locate the asset on the server. Defaults toLLMS_PLUGIN_URL
. - 'path'
(string) The relative path to the asset within the plugin directory. Defaults toassets/js
for scripts andassets/css
for styles. - 'extension'
(string) The filename extension for the asset. Defaults to.js
for scripts and.css
for styles. - 'suffix'
(string) The file suffix for the asset, for example.min
for minified files. Defaults toLLMS_ASSETS_SUFFIX
. - 'dependencies'
(string[]) An array of asset handles the asset depends on. These assets do not necessarily need to be assets defined by LifterLMS, for example WP Core scripts, such asjquery
, can be used. - 'version'
(string) The asset version. Defaults toLLMS_VERSION
. - 'package_id'
(string) An ID used to identify the originating plugin or theme that defined the asset. - 'in_footer'
(boolean) (Forscript
assets only) Whether or not the script should be output in the footer. Defaults totrue
. - 'translate'
(boolean) (Forscript
assets only) Whether or not script translations should be set. Defaults tofalse
. - 'rtl'
(boolean) (Forstyle
assets only) Whether or not to automatically add RTL style data for the stylesheet. Defaults totrue
. - 'media'
(boolean) (Forstyle
assets only) The stylesheet's media type. Defaults toall
.
Source Source
File: includes/class-llms-assets.php
Changelog Changelog
Version | Description |
---|---|
4.4.1 | Replace truthy check with an strict check against false to ensure assets defined with an empty array signifying all default values should be used. |
4.4.0 | Introduced. |