system_settings_deploy.module in Deploy - Content Staging 5
File
system_settings_deploy/system_settings_deploy.module
View source
<?php
function system_settings_deploy_form_alter($form_id, &$form) {
if (!user_access('add items to deployment plan')) {
return;
}
if (isset($form['#base']) && $form['#base'] == 'system_settings_form') {
$weight = $form['buttons']['#weight'];
$form['buttons']['#weight'] = $weight + 1;
$deploy_weight = $weight;
$form['#submit'] = array(
'system_settings_deploy_form_submit' => array(),
) + (array) $form['#submit'];
$plans = deploy_get_plans();
if (!empty($plans)) {
$plans['0'] = '<None>';
natsort($plans);
$form['deploy']['deploy_plan'] = array(
'#type' => 'select',
'#title' => t('Deployment Plan'),
'#description' => t('A deployment plan to add these settings to, or none'),
'#weight' => $deploy_weight,
'#options' => $plans,
);
}
}
}
function system_settings_deploy_form_submit($form_id, $form_values) {
$pid = $form_values['deploy_plan'];
if (array_key_exists("deploy_plan", $form_values)) {
unset($form_values["deploy_plan"]);
}
$data = serialize($form_values);
if ($pid != '0') {
deploy_add_to_plan($pid, 'system_settings', 'Settings: ' . $form_id, $data);
}
$result = db_query("select * from {deploy_plan_items} where module = 'system_settings'");
while ($row = db_fetch_array($result)) {
deploy_update_item($row['iid'], $data);
}
}
function system_settings_deploy($url, $api_key, $data) {
return xmlrpc($url, 'system_settings.import', $api_key, unserialize($data));
}