xPDO.getOption

Welcome to the MODX Documentation. It is an ongoing effort of the MODX community. If you would like to participate or if you notice any errors or missing content, please let us know.

xPDO::getOption

Get an xPDO configuration option value by key.

Syntax

API Docs: http://api.modxcms.com/xpdo/xPDO.html#getOption

mixed getOption (string $key, [array $options = null], [mixed $default = null])

Examples

Get the table prefix:

$tablePrefix = $xpdo->getOption(xPDO_OPT_TABLE_PREFIX);

Get an option from a user-specified array, and if not set, check for it in $xpdo->config. If it's not set there, return false as its default value:

$mySetting = $xpdo->getOption('my_setting',$myConfig,false);

See Also