Source: ~/modules/cms/classes/Asset.php


The CMS theme asset file class.

Public properties

public string $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

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

The container name inside the theme.

protected string $originalFileName

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

protected array $fillable

The attributes that are mass assignable.

protected array $allowedExtensions

Allowable file extensions.

Show inherited protected properties

Inherited protected properties

Public methods

public void __construct(Cms\Classes\Theme $theme)

Creates an instance of the object and associates it with a CMS theme.


public void delete()

public void fill(array $attributes)

Sets the object attributes.

  • array $attributes - A list of attributes to set.

public mixed|static find(string $fileName)

Find a single template by its file name.

  • string $fileName

public static array getEditableExtensions()

Returns a list of editable asset extensions. The list can be overridden with the cms.editableAssetTypes configuration option.

public string getFileName()

Returns the file name.

public string getFilePath(string $fileName=NULL)

Returns the absolute file path.

  • string $fileName - Specifies the file name to return the path to.

public static $this inTheme(Cms\Classes\Theme|string $theme)

Prepares the theme datasource for the model.

  • Cms\Classes\Theme|string $theme - Specifies a parent theme.

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

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

  • Cms\Classes\Theme $theme - Specifies the theme the object belongs to.
  • string $fileName - Specifies the file name, with the extension. The file name can contain only alphanumeric symbols, dashes and dots.

public void save()

Saves the object to the disk.

Show inherited public methods

Inherited public methods

Protected methods

protected void validateFileName(string $fileName=NULL)

Validate the supplied filename, extension and path.

  • string $fileName

Show inherited protected methods

Inherited protected methods

  • protected boolean extendableIsAccessible(mixed $class, string $propertyName) - defined in October\Rain\Extension\Extendable. Checks if a property is accessible, property equivalent of is_callable().
  • protected void extensionExtractMethods(string $extensionName, object $extensionObject) - defined in October\Rain\Extension\Extendable. Extracts the available methods from a behavior and adds it to the.