function RulesPluginUI::form_validate

Implements RulesPluginUIInterface.

Overrides RulesPluginUIInterface::form_validate

2 calls to RulesPluginUI::form_validate()
RulesAbstractPluginUI::form_validate in ui/ui.core.inc
RulesLoopUI::form_validate in ui/ui.plugins.inc
Implements RulesPluginUIInterface.
2 methods override RulesPluginUI::form_validate()
RulesAbstractPluginUI::form_validate in ui/ui.core.inc
RulesLoopUI::form_validate in ui/ui.plugins.inc
Implements RulesPluginUIInterface.

File

ui/ui.core.inc, line 359

Class

RulesPluginUI
Faces UI extender for all kind of Rules plugins.

Code

public function form_validate($form, &$form_state) {
    $this->form_extract_values($form, $form_state);
    $form_values = RulesPluginUI::getFormStateValues($form, $form_state);
    if (isset($form_values['provides'])) {
        $vars = $this->element
            ->availableVariables();
        foreach ($form_values['provides'] as $name => $values) {
            if (isset($vars[$values['var']])) {
                form_error($form['provides'][$name]['var'], t('The variable name %name is already taken.', array(
                    '%name' => $values['var'],
                )));
            }
        }
    }
    // Settings have been updated, so process them now.
    $this->element
        ->processSettings(TRUE);
    // Make sure the current user really has access to configure this element
    // as well as the used input evaluators and data processors.
    if (!user_access('bypass rules access') && !$this->element
        ->root()
        ->access()) {
        form_set_error('', t('Access violation! You have insufficient access permissions to edit this configuration.'));
    }
    if (!empty($form['settings'])) {
        $this->settingsFormValidate($form, $form_state);
    }
}