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

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.

Parameters
Property Description
$name
string | array

When an array of paths are provided they will be passed to the Asset Combiner

$attributes
array

When a string is provided it will be used as the 'build' attribute value

Returns
void

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.

Parameters
Property Description
$name
string | array

When an array of paths are provided they will be passed to the Asset Combiner

$attributes
array

When a string is provided it will be used as the 'build' attribute value

Returns
void

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.

Parameters
Property Description
$name
string
$attributes
array
Returns
void

public addVite (array | string $entrypoints, ?string $package = null) : void

Adds Vite tags

Parameters
Property Description
$entrypoints
array | string

The list of entry points for Vite

$package
?string

The package name of the plugin or theme

Returns
void

public combineAssets (array $assets, string $localPath = "") : string

Run the provided assets through the Asset Combiner

Parameters
Property Description
$assets
array
$localPath
string
Returns
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.

Returns
void

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.

Parameters
Property Description
$fileName
string
$assetPath
mixed
Returns
string

public getAssetPaths () : array

Returns an array of all registered asset paths.

Assets will be prioritized based on their defined ordering.

Returns
array

public hasAssetsDefined () : bool

Returns true if assets any have been added.

Returns
bool

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

Parameters
Property Description
$type
mixed
Returns
string | null

public orderAssets (array $assets) : array

Prioritize assets based on the given order.

Parameters
Property Description
$assets
array
Returns
array

protected addAsset (string $type, string $path, array $attributes) : void

Adds the provided asset to the internal asset collections

Parameters
Property Description
$type
string
$path
string
$attributes
array
Returns
void

protected getAssetEntryBuildPath (array $asset) : string

Internal helper, attaches a build code to an asset path

Parameters
Property Description
$asset
array
Returns
string

protected getAssetScheme (string $asset) : string

Internal helper, get asset scheme

Parameters
Property Description
$asset
string
Returns
string

protected getLocalPath (string | null $relativePath) : string

Parameters
Property Description
$relativePath
string | null
Returns
string

protected removeDuplicates () : void

Removes duplicate assets from the entire collection.

Returns
void

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.

Copyright © 2024 Winter CMS