You are here

function rules_forms_action_set_error in Rules Forms Support 7.2

Same name and namespace in other branches
  1. 7 includes/rules_forms.eval.inc \rules_forms_action_set_error()

Action: Set form error.

Parameters

EntityMetadataWrapper $wrapper: The wrapped form element on which to set the error, if any.

string $message: The error message to set on the form element.

1 string reference to 'rules_forms_action_set_error'
rules_forms_rules_action_info in ./rules_forms.rules.inc
Implements hook_rules_action_info().

File

includes/rules_forms.eval.inc, line 226
Evaluation functions for Rules Forms module.

Code

function rules_forms_action_set_error(EntityMetadataWrapper $wrapper, $message, $settings, $state, $element) {

  // Use the data selector structure to target the form element.
  if ($wrapper instanceof RulesFormsElementWrapper) {
    $element = $wrapper
      ->getElementName();
  }
  else {
    $element = '';
  }
  form_set_error($element, $message);
}