Skip to content

Component Configuration

flack edited this page Dec 8, 2016 · 8 revisions

Default configuration for Components is stored in the file config.inc in the component's config folder in the following format:

'show_archive' => false,

Reading Config Values

In classes derived from the Component Baseclasses, the current configuration is available in the attribute _config:

$show_archive = $this->_config->get('show_archive');

The same information is available in the component's Style Elements through $data['config']:

$show_archive = $data['config']->get('show_archive');

To access config information from outside the component source or from DBA classes, it is available via

$config = midcom_baseclasses_components_configuration::get('net.nehmer.blog', 'config');
$show_archive = $config->get('show_archive');

Overriding Config Values

You can override the default config values in your project's config/midcom directory by creating a subfolder named like your component (e.g. net.nehmer.blog) and creating a file called config.inc. Settings are merged, so the ones you don't override will still use the component defaults.

If you don't want to store your configuration in the filesystem, you can also save it in the database in a special Snippetdir called sitegroup-config. To configure a component, a Subsnippetdir with the name of the component has to be created, and then a Snippet named config.

Additionally, you can also set config values for specific Topics, which are then saved as Parameters in the database. These take precedence over both the component defaults and the project config/sitegroup-config values.

If you provide an appropriate [Datamanager Schema](Datamanager Schemas) component configuration can be done in the UI, either in the Asgard backend, or via the MidCOM Toolbar.

Clone this wiki locally