\midcom_helper__componentloader

This class is a Factory that is responsible for loading and
establishing the interface to a MidCOM Component.

Working with components

Normally, two things are important when you deal with other components:

First, if you want to list other components, or for example check whether they
are available, you should use the component manifest listing, known as $manifests.
It gives you all meta-information about the components.

This should actually suffice for most normal operations.

If you develop framework tools (like administration interfaces), you will also
need access to the component interface class, which can be obtained by
get_interface_class(). This class is derived from the component interface
baseclass and should give you everything you need to work with the component
and its information itself.

Other than that, you should not have to deal with the components, perhaps with
the only exception of is_loaded() and load() to ensure other components are loaded
in case you need them and they are not a pure-code library.

Loading components

When the component loader receives a request it roughly works in
three stages:

Verify that the given component is valid in terms of the MidCOM Specification.

Return the various interface concepts upon each request
from the framework.

Stage 1 will do all basic sanity checking. If anything is missing, step 1
fails and the componentloader refuses to load the component.

Stage 2 will then load the interfaces.php file from the midcom
directory. The existence of all required Interface classes is
then checked. If this check is successful, the concrete classes
of the various interface concepts are instantiated and stored
internally. The component is initialized by the call to
initialize() which should load everything necessary.

Stage 3 is the final stage where the loader stays in memory in
order to return the loaded component's Interface instances upon request.

In case you need an instance of the component loader to verify or
transform component paths, use midcom::get()->componentloader

Tags

None found

Properties

$manifests

$manifests : array<mixed,\midcom_core_manifest>

This lists all available components in the systems in the form of their manifests,
indexed by the component name. Whenever possible you should refer to this listing
to gain information about the components available.

Type

Tags

$_loaded

This indexed array stores the MidCOM paths of all loaded
components. Its elements are used as keys for the cache storage.

Type

Array

Tags

None found

$_tried_to_load

$_tried_to_load : array

This array contains a list of components that were tried to be loaded.

The components are added to this list even if the system only tried
to load it and failed. This way we protect against duplicate class errors
and the like if a defective class is tried to be loaded twice.

The array maps component names to loading results. The loading result is
either false or true as per the result of the load call.

Tags

get_all_manifest_customdata()

Build a complete set of custom data associated with a given component
identifier. In case a given component does not have the key set and the boolean parameter
is set to true, an empty array is added implicitly.

Parameters

string

$component

The custom data component index to look for.

boolean

$showempty

Set this flag to true to get an (empty) entry for all components which
don't have customdata applicable to the component index given. This is disabled by default.

Returns

Array
—

All found component data indexed by known components.

Tags

None found

get_component_icon()

get_component_icon( $component, $provide_fallback = true)

Parameters

$component

$provide_fallback

Tags

None found

_load()

_load(string $path) : boolean

Load the component specified by $path. If the component could not be loaded
successfully due to integrity errors, it will return false.

Parameters

string

$path

The component to load.

Returns

boolean
—

Indicating success.

Tags

None found

_register_manifest()

_register_manifest(\midcom_core_manifest $manifest)

Register manifest data.

All default privileges are made known to ACL, the watches are registered