function RulesPluginUI::settingsFormSubmit

Parameters

array $form: The form array where to add the form.

array $form_state: The current form state.

1 call to RulesPluginUI::settingsFormSubmit()
RulesPluginUI::form_submit in ui/ui.core.inc
Implements RulesPluginUIInterface.

File

ui/ui.core.inc, line 654

Class

RulesPluginUI
Faces UI extender for all kind of Rules plugins.

Code

public function settingsFormSubmit($form, &$form_state) {
    if (isset($form_state['values']['settings']['access']) && !empty($this->element->access_exposed)) {
        // Save the permission matrix.
        foreach ($form_state['values']['settings']['access']['permissions']['matrix']['checkboxes'] as $rid => $value) {
            // Need to account for the case where the machine name has been changed,
            // because then the $value array variable will be keyed with the wrong
            // permission name. So here we recompute the permission name to use as
            // a key and extract the value from the $value array.
            $component_permission = rules_permissions_by_component(array(
                $this->element,
            ));
            $component_permission_name = key($component_permission);
            user_role_change_permissions($rid, array(
                $component_permission_name => current($value),
            ));
        }
    }
}