function configuration_confirm_delete_submit in Configuration Management 7
Submit handler for deleting configs.
1 string reference to 'configuration_confirm_delete_submit'
- configuration_confirm_delete_multiple in ./
configuration.admin.inc - Form for deleting configs.
File
- ./
configuration.admin.inc, line 642
Code
function configuration_confirm_delete_submit($form, &$form_state) {
$a =& drupal_static('configuration_from_activestore');
$a = TRUE;
$to_delete = $form_state['values']['config_name'];
$last_count = 0;
while (count($to_delete) > 0 && $last_count != count($to_delete)) {
$last_count = count($to_delete);
foreach ($to_delete as $index => $name) {
$parts = explode(':', $name);
$configs = db_query("SELECT cid, parent FROM {config_export} WHERE owner = :owner AND name = :name", array(
":owner" => $parts[0],
":name" => $parts[1],
))
->fetchAll();
// Only remove the config is it doesn't have parents that depends of this config
foreach ($configs as $config) {
if (empty($config->parent)) {
$delete[] = $config->cid;
}
}
if (!empty($delete)) {
if (configuration_delete_multiple($delete)) {
drupal_set_message(t('The configuration %config_name was deleted.', array(
'%config_name' => $name,
)));
watchdog('content', 'Deleted configuration @config_name and its replies.', array(
'@config_name' => $name,
));
// Remove the item of the list to process
unset($to_delete[$index]);
}
}
}
}
if (count($to_delete) > 0) {
drupal_set_message(t('Something wrong occurred.'), 'error');
}
$form_state['redirect'] = "admin/config/system/configuration";
}