Nope... This does not even add anything...
$mySettings = array();
$modelPath = $modx->getOption('clientconfig.core_path',null,$modx->getOption('core_path').'components/clientconfig/').'model/';
$modx->addPackage('clientconfig',$modelPath);
$mySettings[1]= $modx->newObject('cgGroup');
$mySettings[1]->fromArray(array (
'id' => '1',
'label' => 'Site settings',
'description' => 'General settings for the site',
), '', true, true);
$groupSettings = array();
$groupSettings[1] = $modx->newObject('cgSetting');
$groupSettings[1]->fromArray(array (
'id' => 1,
'key' => 'footer_text',
'title' => 'Footer text',
'description' => 'Content of the footer text',
'value' => 'This is the default footer text',
'xtype' => 'textfield',
'group' => '1',
), '', true, true);
$groupSettings[2] = $modx->newObject('cgSetting');
$groupSettings[2]->fromArray(array (
'id' => 2,
'key' => 'flex-4-header-logo',
'title' => 'Header logo',
'description' => 'Main logo for your website',
'value' => '',
'xtype' => 'source',
'group' => '1',
), '', true, true);
$groupSettings[3] = $modx->newObject('cgSetting');
$groupSettings[3]->fromArray(array (
'id' => 3,
'key' => 'flex-4-header-logo-alt',
'title' => 'Header logo alt text',
'description' => 'The alt text for the main logo of your website (e.g. company logo)',
'value' => '',
'xtype' => 'textfield',
'group' => '1',
), '', true, true);
$groupSettings[4] = $modx->newObject('cgSetting');
$groupSettings[4]->fromArray(array (
'id' => 4,
'key' => 'flex-4-header-logo-link-id',
'title' => 'Homepage page ID',
'description' => 'Page ID of the header logo link (default = 1)',
'value' => '1',
'xtype' => 'textfield',
'group' => '1',
), '', true, true);
$groupSettings[5] = $modx->newObject('cgSetting');
$groupSettings[5]->fromArray(array (
'id' => 5,
'key' => 'flex-4-header-logo-link-title',
'title' => 'Header logo link title',
'description' => 'Title of the logo link',
'value' => '',
'xtype' => 'textfield',
'group' => '1',
), '', true, true);
$mySettings[1]->addMany($groupSettings);
return $mySettings;
in Build transport:
/* load system settings */
if ($hasSettings) {
$settings = include $sources['data'].'transport.settings.php';
if (!is_array($settings)) {
$modx->log(modX::LOG_LEVEL_ERROR,'Could not package in settings.');
} else {
$attributes= array(
xPDOTransport::UNIQUE_KEY => 'label',
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => false,
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'Settings' => array(
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => false,
xPDOTransport::UNIQUE_KEY => 'key',
),
),
);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting,$attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($settings).' System Settings.');
unset($settings,$setting,$attributes);
}
}