<?php
/** Array of system settings for Flexibility package
* @package flexibility
* @subpackage build
*/
/* This section is ONLY for new System Settings to be added to
* The System Settings grid. If you include existing settings,
* they will be removed on uninstall. Existing setting can be
* set in a script resolver (see install.script.php).
*/
$settings = array();
/* The first three are new settings */
$modelPath = $modx->getOption('clientconfig.core_path',null,$modx->getOption('core_path').'components/clientconfig/').'model/';
$modx->addPackage('clientconfig',$modelPath);
$settings['group']= $modx->newObject('cgGroup');
$settings['group']->fromArray(array (
'id' => '1',
'label' => 'Site settings',
'description' => 'General settings for the site',
), '', true, true);
$groupSettings = array();
$groupSettings['footerText'] = $modx->newObject('cgSetting');
$groupSettings['footerText']->fromArray(array (
'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['flex-4-header-logo'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo']->fromArray(array (
'key' => 'flex-4-header-logo',
'title' => 'Header logo',
'description' => 'Main logo for your website',
'value' => '',
'xtype' => 'image',
'group' => '1',
), '', true, true);
$groupSettings['flex-4-header-logo-alt'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-alt']->fromArray(array (
'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['flex-4-header-logo-link-id'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-link-id']->fromArray(array (
'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['flex-4-header-logo-link-title'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-link-title']->fromArray(array (
'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);
$settings['group']->addMany($groupSettings);
return $settings;/* 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);
}
}/* 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);
}
}<?php
/** Array of system settings for Flexibility package
* @package flexibility
* @subpackage build
*/
/* This section is ONLY for new System Settings to be added to
* The System Settings grid. If you include existing settings,
* they will be removed on uninstall. Existing setting can be
* set in a script resolver (see install.script.php).
*/
$settings = array();
/* The first three are new settings */
$modelPath = $modx->getOption('clientconfig.core_path',null,$modx->getOption('core_path').'components/clientconfig/').'model/';
$modx->addPackage('clientconfig',$modelPath);
$settings['group']= $modx->newObject('cgGroup');
$settings['group']->fromArray(array (
'id' => '1',
'label' => 'Site settings',
'description' => 'General settings for the site',
), '', true, true);
$groupSettings = array();
$groupSettings['footerText'] = $modx->newObject('cgSetting');
$groupSettings['footerText']->fromArray(array (
'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['flex-4-header-logo'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo']->fromArray(array (
'key' => 'flex-4-header-logo',
'title' => 'Header logo',
'description' => 'Main logo for your website',
'value' => '',
'xtype' => 'source',
'group' => '1',
), '', true, true);
$groupSettings['flex-4-header-logo-alt'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-alt']->fromArray(array (
'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['flex-4-header-logo-link-id'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-link-id']->fromArray(array (
'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['flex-4-header-logo-link-title'] = $modx->newObject('cgSetting');
$groupSettings['flex-4-header-logo-link-title']->fromArray(array (
'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);
$settings['group']->addMany($groupSettings);
return $settings;