You are here

function rules_element_invoke in Rules 6

Invokes an element specific function. E.g. this is used for invoking actions.

Parameters

$op The operation to invoke. If one is given, it will be appended to the: function base name, separated by an underscore.

$params An array of parameters which should be passed to the invoked: function.

$error Whether an error should be generated, when no implementation is found.:

Return value

FALSE, if no implementation is found. Else the return of the implementation will be passed through.

7 calls to rules_element_invoke()
rules_admin_element_alter_form in rules_admin/rules_admin.rule_forms.inc
Allows the element to alter the default configuration form
rules_admin_element_alter_form_submit in rules_admin/rules_admin.rule_forms.inc
rules_admin_element_alter_form_validate in rules_admin/rules_admin.rule_forms.inc
rules_admin_element_help in rules_admin/rules_admin.inc
Shows the element help
rules_execute_action in rules/rules.module
Execution handler for actions

... See full list

File

rules/rules.module, line 603
Rules engine module

Code

function rules_element_invoke($element, $op = '', $params, $error = TRUE) {
  $op = $op ? '_' . $op : '';
  if (($info = rules_get_element_info($element)) && isset($info['base'])) {
    if (function_exists($function = $info['base'] . $op)) {
      return call_user_func_array($function, $params);
    }
  }
  if (isset($element['#name']) && function_exists($function = $element['#name'] . $op)) {
    return call_user_func_array($function, $params);
  }
  if ($error) {
    rules_error_missing_implementation($element);
  }
  return FALSE;
}