\apex\app\syscomponents

Components Library

Service: apex\services\utils\components

Handles all internal components, such as checking whether or not a component exists, loading a component via the dependency injection container, obtaining the tpl/php file locations of a component, etc.

This class is available within the services container, meaning its methods can be accessed statically via the service singleton as shown below.

PHP Example

</php

namespace apex;

use apex\app; use apex\services\utils\components;

// Load a component $client = components::load('worker', 'myworker', 'somepackage');

Summary

Methods
Properties
Constants
check()
load()
call()
get_file()
get_tpl_file()
get_tabcontrol_files()
get_all_files()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
get_class_name()
No private properties found
N/A

Methods

check()

check(string  $type, string  $alias) : \apex\app\sys\mixed/array

Check if component exists

Takes in the component type and alias, formatted in standard Apex format (PACKAGE:[PARENT:]ALIAS), checks to see if it exists, and returns an array of the package, parent and alias.

Parameters

string $type

The component type (eg. htmlfunc, lib, modal, etc.)

string $alias

Apex formatted component alias (PACAKGE:[PARENT:]ALIAS)

Returns

\apex\app\sys\mixed/array —

Returns false if no components exists, otherwise returns array of the package, parent and alias.

load()

load(string  $type, string  $alias, string  $package = '', string  $parent = '', array  $data = array()) : mixed

Load a component

Loads a component, and returns the initialized object.

Parameters

string $type

The component type (eg. htmlfunc, lib, modal)

string $alias

The alias of the components

string $package

The package alias of the components.

string $parent

The parent alias of the components, if exists

array $data

Optional array with extra data, generally the attributes of the tag that is loading the components.

Returns

mixed —

Returns false if unable to load components, otherwise returns the newly initialized object.

call()

call(string  $function_name, string  $type, string  $alias, string  $package = '', string  $parent = '', array  $data = array()) : mixed

Call a function within a component

Parameters

string $function_name

The name of the function / method to call.

string $type

The component type (eg. htmlfunc, lib, modal)

string $alias

The alias of the components

string $package

The package alias of the components.

string $parent

The parent alias of the components, if exists

array $data

Optional array of additional name based arguments to pass to the function.

Returns

mixed —

Returns false if unable to load components, otherwise returns the newly initialized object.

get_file()

get_file(string  $type, string  $alias, string  $package, string  $parent = '') : string

Get the location of a component's PHP file

Parameters

string $type

The component type (eg. htmlfunc, modal, lib, etc.)

string $alias

The alias of the components

string $package

The package alias of the components

string $parent

The parent alias of the components, if one exists.

Returns

string —

The full path to the PHP class file of the components.

get_tpl_file()

get_tpl_file(string  $type, string  $alias, string  $package, string  $parent = '') : string

Get the TPL file of any given template.

Parameters

string $type

The component type (template, modal, htmlfunc, etc.)

string $alias

The alias of the component

string $package

The package alias of the component

string $parent

The parent alias of the component, if exists

Returns

string —

The full path to the TPL file of the component

get_tabcontrol_files()

get_tabcontrol_files(string  $alias, string  $package) : array

Gets all files, .php and .tpl associated with a tab control.

Parameters

string $alias

The alias of the tab control.

string $package

The package alias of the tab control.

Returns

array —

One-dimensional array of files.

get_all_files()

get_all_files(string  $type, string  $alias, string  $package, string  $parent = '') : array

Get all files associated with the given component

Parameters

string $type

The component type (template, modal, htmlfunc, etc.)

string $alias

The alias of the component

string $package

The package alias of the component

string $parent

The parent alias of the component, if exists

Returns

array —

List of all files associated with the component

get_class_name()

get_class_name(string  $type, string  $alias, string  $package, string  $parent = '') : string

Get the full class name of a component

Parameters

string $type

The component type (eg. htmlfunc, lib, modal)

string $alias

The alias of the components

string $package

The package alias of the components.

string $parent

Optional parent alias of the component

Returns

string —

The full class name of the component