This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

Many packages use the Config table of the database if there are only a few package wide settings. There is a class to interface to it and more info in the documentation.

http://www.concrete5.org/documentation/developers/system/config-preference-data/

Any add-on can use the config table for storing/retrieving the settings.

Save

$pkg  = Package::getByHandle('my_package_handle');
$pkg->saveConfig('MY_CONFIG_SYMBOL', $data );

Retrieve

$pkg  = Package::getByHandle('my_package_handle');
$data = $pkg->config('MY_CONFIG_SYMBOL');

The usual convention is that config symbols are upper-case, but this is not set in stone.

Php serialize/unserialize or json can be used to store more complex data structures in config.

Clear

If you want to completely erase a config symbol/value:

$pkg->clearConfig('MY_CONFIG_SYMBOL');

Read more How-tos by JohntheFish

Loading Conversation