Configuration class for components.

package midcom.baseclasses

 Methods

get ($component, $key)

Static

Parameters

$component

$key

read_array_from_file (string $filename)

This helper function reads a file from disk and evaluates its content as array.
Static

This is essentially a simple Array($data\n) eval construct.

If the file does not exist, false is returned.

see \read_array_from_snippet()

Parameters

$filename

stringThe name of the file that should be parsed.

Returns

ArrayThe read data or false on failure.

read_array_from_snippet (string $snippetpath)

This helper function reads a snippet and evaluates its content as array.
Static

This is essentially a simple Array($data\n) eval construct.

If the snippet does not exist, false is returned.

see \read_array_from_file()

Parameters

$snippetpath

stringThe full path to the snippet that should be returned.

Returns

ArrayThe read data or false on failure.

set ($component, $key, $value)

Static

Parameters

$component

$key

$value

_initialize ($component)

Initialize the global data storage
Static

Parameters

$component

_load_configuration ($component)

Loads the configuration file specified by the component configuration and constructs a midcom_helper_configuration object out of it.
Static

Both Component defaults and sitegroup-configuration gets merged. The resulting object is stored under the key 'config' in the component's data storage area.

Three files will be loaded in order:

  1. The component's default configuration, placed in $prefix/config/config.inc
  2. Any systemwide default configuration, currently placed in midcom::get('config')->get('midcom_config_basedir')/midcom/$component/config.inc.
  3. Any site configuration in the snippet midcom::get('config')->get('midcom_sgconfig_basedir')/$component/config.
see \midcom_helper_configuration

Parameters

$component

_load_routes ($component)

Static

Parameters

$component

 Properties

 

array $_data

This is a component specific global data storage area, which should be used for stuff like default configurations etc.

thus avoiding the pollution of the global namespace. Each component has its own array in the global one, allowing storage of arbitrary data indexed by arbitrary keys in there. The component-specific arrays are indexed by their name.

Note, that this facility is quite a different thing to the component context from midcom_application, even if it has many similar applications. The component context is only available and valid for components, which are actually handling a request. This data storage area is static to the complete component and shared over all subrequests and therefore suitable to hold default configurations, -schemas and the like.