Asset for CMS asset files


Public Properties

public string $fileName

fileName specifies the file name corresponding the CMS object

public string $mtime

Last modified time.

public string $content

The entire file content.

public bool $exists

exists indicates if the model exists.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected Cms\Classes\Theme $theme

A reference to the CMS theme containing the object.

protected string $dirName

dirName for the container name inside the theme

protected string $originalFileName

Specifies the file name, the CMS object was loaded from.

protected array $fillable

fillable attributes that are mass assignable

protected array $allowedExtensions

allowedExtensions for template files

Show inherited protected properties

Inherited Protected Properties

Public Methods

public __construct()

public __construct($theme): void

__construct creates an instance of the object and associates it with a CMS theme

public delete()

public delete(): void

delete the object from disk

public fill()

public fill(array $attributes): void

Sets the object attributes.

public find()

public find($fileName): void

find a single template by its file name.

public get()

public get($options = []): array 

get all assets in a theme and uses simple objects

Available options:

  • recursive: search subfolders and place in 'assets' key
  • flatten: produce a flat array instead of a recursive array
  • filterPath: only include within an inner path
  • filterFiles: only include files
  • filterFolders: only include folders
  • filterEditable: only show editable assets

public static getEditableExtensions()

public static getEditableExtensions(): array 

getEditableExtensions returns a list of editable asset extensions The list can be overridden with the cms.editable_asset_types configuration option.

public getFileName()

public getFileName(): string 

public getFilePath()

public getFilePath($fileName = null): string 

getFilePath returns the absolute file path of an asset

public static inTheme()

public static inTheme($theme): Cms\Classes\Asset 

inTheme prepares the theme datasource for the model.

public static listInTheme()

public static listInTheme($theme, $options = []): void

public static load()

public static load(Cms\Classes\Theme $theme, string $fileName): mixed 

load the object from a file This method is used in the CMS back-end. It doesn't use any caching.

public save()

public save(): void

save the object to the disk

public validate()

public validate(): void

validate object

Show inherited public methods

Inherited Public Methods

Protected Methods

protected getInternal()

protected getInternal($path, $theme): array 

getInternal helps the get method

protected getRelativePath()

protected getRelativePath($path, $theme): string 

getRelativePath returns path relative to the theme asset directory

protected validateFileName()

protected validateFileName(string $fileName = null): void

validateFileName supplied with extension and path.

Show inherited protected methods

Inherited Protected Methods