-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- System
- Traits
- AssetMaker
System\Traits\AssetMaker
Source: ~/modules/system/traits/AssetMaker.php
Asset Maker Trait Adds asset based methods to a class
Public properties
public string $assetPath
Specifies a path to the asset directory.
Protected properties
protected array $assets
Collection of assets to display in the layout.
Public methods
public void addCss(string $name, array $attributes=array())
Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the script.
- array $attributes - Adds extra HTML attributes to the asset link.
public void addJs(string $name, array $attributes=array())
Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the script.
- array $attributes - Adds extra HTML attributes to the asset link.
public void addRss(string $name, array $attributes=array())
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the RSS channel
- array $attributes - Adds extra HTML attributes to the asset link.
public string combineAssets(array $assets, string $localPath='')
Run the provided assets through the Asset Combiner
Parameters
- array $assets - Collection of assets
- string $localPath - Prefix all assets with this path (optional)
public void flushAssets()
Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.
public string getAssetPath(string $fileName, string $assetPath=NULL)
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
Parameters
- string $fileName - File to load.
- string $assetPath - Explicitly define an asset path.
public array getAssetPaths()
Returns an array of all registered asset paths.
public bool hasAssetsDefined()
Returns true if assets any have been added.
public string makeAssets(string $type=NULL)
Outputs <link>
and <script>
tags to load assets previously added with addJs and addCss method calls
Parameters
- string $type - Return an asset collection of a given type (css, rss, js) or null for all.
Protected methods
protected void addAsset(string $type, string $path, array $attributes)
Adds the provided asset to the internal asset collections
Parameters
- string $type - The type of the asset: 'js' || 'css' || 'rss'
- string $path - The path to the asset
- array $attributes - The attributes for the asset
protected string getAssetEntryBuildPath(array $asset)
Internal helper, attaches a build code to an asset path
Parameters
- array $asset - Stored asset array
protected string getAssetScheme(string $asset)
Internal helper, get asset scheme
Parameters
- string $asset - Specifies a path (URL) to the asset.
protected void getLocalPath($relativePath)
Parameters
- $relativePath
protected void removeDuplicates()
Removes duplicate assets from the entire collection.