AssetMaker
Asset Maker Trait
Adds asset based methods to a class
trait System\Traits\AssetMaker
Properties
public $assetPath : string
Specifies a path to the asset directory.
protected
$assets
:
array
= {"js":[],"css":[],"rss":[],"vite":[]}
Collection of assets to display in the layout.
protected $orderFactor : integer
Ensures "first-come, first-served" applies to assets of the same ordering.
Methods
public
addCss (string | array $name, array $attributes = []
)
: void
Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Property | Type | Description |
---|---|---|
$name | string | array |
string | array
When an array of paths are provided they will be passed to the Asset Combiner |
$attributes | array |
array
When a string is provided it will be used as the 'build' attribute value |
public
addJs (string | array $name, array $attributes = []
)
: void
Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Property | Type | Description |
---|---|---|
$name | string | array |
string | array
When an array of paths are provided they will be passed to the Asset Combiner |
$attributes | array |
array
When a string is provided it will be used as the 'build' attribute value |
public
addRss (string $name, array $attributes = []
)
: void
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Property | Type | Description |
---|---|---|
$name | string |
string
|
$attributes | array |
array
|
public
addVite (array | string $entrypoints, ?string $package = null
)
: void
Adds Vite tags
Property | Type | Description |
---|---|---|
$entrypoints | array | string |
array | string
The list of entry points for Vite |
$package | ?string |
?string
The package name of the plugin or theme |
public
combineAssets (array $assets, string $localPath = ""
)
: string
Run the provided assets through the Asset Combiner
Property | Type | Description |
---|---|---|
$assets | array |
array
|
$localPath | string |
string
|
public flushAssets () : void
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
getAssetPath (string $fileName, $assetPath = null
)
: string
Returns the URL to the provided asset. If the provided fileName is a relative path without a leading slash it will be assumbed to be relative to the asset path.
Property | Type | Description |
---|---|---|
$fileName | string |
string
|
$assetPath | mixed |
mixed
|
public getAssetPaths () : array
Returns an array of all registered asset paths.
Assets will be prioritized based on their defined ordering.
public hasAssetsDefined () : bool
Returns true if assets any have been added.
public
makeAssets ($type = null
)
: string | null
Outputs <link>
and <script>
tags to load assets previously added
with addJs, addCss, & addRss method calls depending on the provided $type
Property | Type | Description |
---|---|---|
$type | mixed |
mixed
|
public orderAssets (array $assets) : array
Prioritize assets based on the given order.
Property | Type | Description |
---|---|---|
$assets | array |
array
|
protected addAsset (string $type, string $path, array $attributes) : void
Adds the provided asset to the internal asset collections
Property | Type | Description |
---|---|---|
$type | string |
string
|
$path | string |
string
|
$attributes | array |
array
|
protected getAssetEntryBuildPath (array $asset) : string
Internal helper, attaches a build code to an asset path
Property | Type | Description |
---|---|---|
$asset | array |
array
|
protected getAssetScheme (string $asset) : string
Internal helper, get asset scheme
Property | Type | Description |
---|---|---|
$asset | string |
string
|
protected getLocalPath (string | null $relativePath) : string
Property | Type | Description |
---|---|---|
$relativePath | string | null |
string | null
|
protected removeDuplicates () : void
Removes duplicate assets from the entire collection.
Used by
Class | Description |
---|---|
EventLogs
|
Event Logs controller |
MailBrandSettings
|
Mail brand customization controller |
MailLayouts
|
Mail layouts controller |
MailPartials
|
Mail partials controller |
MailTemplates
|
Mail templates controller |
RequestLogs
|
Request Logs controller |
Settings
|
Settings controller |
Updates
|
Updates controller |
Status
|
System status report widget. |
FormController
|
Adds features for working with backend forms. This behavior will inject CRUD actions to the controller -- including create, update and preview -- along with some relevant AJAX handlers. |
ImportExportController
|
Adds features for importing and exporting data. |
ListController
|
Adds features for working with backend lists. |
RelationController
|
Uses a combination of lists and forms for managing Model relations. |
ReorderController
|
Used for reordering and sorting records. |
Controller
|
The Backend base controller class, used by Backend controllers. |
ControllerBehavior
|
Controller Behavior base class |
FormWidgetBase
|
Form Widget base class Widgets used specifically for forms |
ReportWidgetBase
|
Report Widget base class Report widgets are used inside the ReportContainer. |
WidgetBase
|
Widget base class. |
AccessLogs
|
Access Logs controller |
Auth
|
Authentication controller |
Files
|
Backend files controller |
Index
|
Dashboard controller |
Media
|
Backend Media Manager |
Preferences
|
Editor Settings controller |
UserGroups
|
Backend user groups controller |
UserRoles
|
Backend user groups controller |
Users
|
Backend user controller |
CodeEditor
|
Code Editor Renders a code editor field. |
ColorPicker
|
Color picker Renders a color picker field. |
DataTable
|
Data Table Renders a table field. |
DatePicker
|
Date picker Renders a date picker field. |
FileUpload
|
File upload field Renders a form file uploader field. |
IconPicker
|
Icon picker Renders an icon picker field. |
MarkdownEditor
|
Code Editor Renders a code editor field. |
MediaFinder
|
Media Finder Renders a record finder field. |
NestedForm
|
Nested Form Renders a nested form bound to a jsonable field of a model. |
PermissionEditor
|
User/group permission editor This widget is used by the system internally on the System / Administrators pages. |
RecordFinder
|
Record Finder Renders a record finder field. |
Relation
|
Form Relationship Renders a field prepopulated with a belongsTo and belongsToHasMany relation. |
RelationManager
|
|
Repeater
|
Repeater Form Widget |
RichEditor
|
Rich Editor Renders a rich content editor field. |
Sensitive
|
Sensitive widget. |
TagList
|
Tag List Form Widget |
Welcome
|
User welcome report widget. |
Filter
|
Filter Widget Renders a container used for filtering things. |
Form
|
Form Widget Used for building back end forms and renders a form. |
Lists
|
List Widget Used for building back end lists, renders a list of model objects |
MediaManager
|
Media Manager widget. |
ReportContainer
|
Report Container Widget Creates an area hosting report widgets. |
Search
|
Search Widget Used for building a toolbar, Renders a search container. |
Table
|
Table Widget. |
Toolbar
|
Toolbar Widget Used for building a toolbar, renders a toolbar. |
ComponentBase
|
Component base class |
Controller
|
The CMS controller class. |
Resources
|
Resources component |
SoftComponent
|
|
UnknownComponent
|
|
ViewBag
|
The view bag stores custom template properties. |
Index
|
CMS index |
Media
|
CMS Media Manager |
ThemeLogs
|
Request Logs controller |
ThemeOptions
|
Theme customization controller |
Themes
|
Theme selector controller |
Components
|
Component Builder Builds a collection of Cms components and configures them. |
MediaFinder
|
Media Finder Renders a record finder field. |
ActiveTheme
|
Active theme report widget. |
AssetList
|
CMS asset list widget. |
ComponentList
|
Component list widget. |
MediaManager
|
Media Manager widget. |
TemplateList
|
Template list widget. |