Cms\Classes\Asset

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

Extends:

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.

Parameters

public void fill(array $attributes)

Sets the object attributes.

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

public mixed|static find(string $fileName)

Find a single template by its file name.

Parameters
  • 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.

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

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

Prepares the theme datasource for the model.

Parameters

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.

Parameters
  • 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.

Parameters
  • 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_callabe().
  • 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.