• PHP reference
  • Interface

Component

class Core\Controller\Component\Component

Loads a CSS and/or Javascript component for the front-end user interface, and processes its metadata and dependencies.

Properties

string $publicDir

string $name

Methods

__construct(string $name, string $dir = null, string $publicDir = null)

Component constructor.

Parameters

  • string $name the name of the component to load
  • string $dir optionally overwrite the directory to load the component from
  • string $publicDir HTTP accessible URL path to serve the component from. Usually starts with a slash.

string[] get_component_files()

Return Value

  • string[]

string|boolean get_component_source(boolean $prettify = false)

Get the source repository or URL of the component. Returns false if unknown.

Parameters

  • boolean $prettify

Return Value

  • string|boolean

string|boolean get_component_version()

Returns the version of the component if available, otherwise returns false.

Return Value

  • string|boolean

string getCode(boolean $comments = false)

Get <link> and <script> tags HTML string to embed the element in your HTML code.

Parameters

  • boolean $comments Whether to add version and component name HTML comments

Return Value

  • string

array get_files(string $type)

Get a list of all of the component's required files with a specific file extension.

Parameters

  • string $type the file extension to filter for

Return Value

  • array

array getComponentDependencies()

Get an array of dependencies of the component. The array contains associative arrays per dependency with fields name and version.

Return Value

  • array