Cms\Classes\Asset

Extends:

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 void __construct($theme)

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

Parameters
  • $theme

public void delete()

public void fill(array $attributes)

Sets the object attributes.

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

public void find($fileName)

find a single template by its file name.

Parameters
  • $fileName

public void 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
Parameters
  • $options

public static array getEditableExtensions()

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

public string getFileName()

Returns the file name.

public void getFilePath($fileName=NULL)

getFilePath returns the absolute file path of an asset

Parameters
  • $fileName

public static void inTheme($theme)

inTheme prepares the theme datasource for the model.

Parameters
  • $theme

public static void listInTheme($theme, $options=array())

listInTheme

Parameters
  • $theme
  • $options

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

load 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.

public void validate()

Show inherited public methods

Inherited public methods

Protected methods

protected void getInternal($path, $theme)

getInternal helps the get method

Parameters
  • $path
  • $theme

protected void getRelativePath($path, $theme)

getRelativePath returns path relative to the theme asset directory

Parameters
  • $path
  • $theme

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_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.