function rules_ui_confirm_operation_apply

Applies the operation and returns the message to show to the user.

The operation is also logged to the watchdog. Note that the string is defined two times so that the translation extractor can find it.

1 call to rules_ui_confirm_operation_apply()
rules_ui_form_rules_config_confirm_op_submit in ui/ui.forms.inc
Rule config deletion form submit callback.

File

ui/ui.forms.inc, line 219

Code

function rules_ui_confirm_operation_apply($op, $rules_config) {
    $vars = array(
        '%plugin' => $rules_config->plugin(),
        '%label' => $rules_config->label(),
    );
    $edit_link = l(t('edit'), RulesPluginUI::path($rules_config->name));
    switch ($op) {
        case 'enable':
            $rules_config->active = TRUE;
            $rules_config->save();
            watchdog('rules', 'Enabled %plugin %label.', $vars, WATCHDOG_NOTICE, $edit_link);
            return t('Enabled %plugin %label.', $vars);
        case 'disable':
            $rules_config->active = FALSE;
            $rules_config->save();
            watchdog('rules', 'Disabled %plugin %label.', $vars, WATCHDOG_NOTICE, $edit_link);
            return t('Disabled %plugin %label.', $vars);
        case 'revert':
            $rules_config->delete();
            watchdog('rules', 'Reverted %plugin %label to the defaults.', $vars, WATCHDOG_NOTICE, $edit_link);
            return t('Reverted %plugin %label to the defaults.', $vars);
        case 'delete':
            $rules_config->delete();
            watchdog('rules', 'Deleted %plugin %label.', $vars);
            return t('Deleted %plugin %label.', $vars);
    }
}