function rules_forms_rules_action_info in Rules Forms Support 7.2
Same name and namespace in other branches
- 7 rules_forms.rules.inc \rules_forms_rules_action_info()
Implements hook_rules_action_info().
File
- ./
rules_forms.rules.inc, line 163 - Rules events, conditions, and actions hooks for Rules Forms module.
Code
function rules_forms_rules_action_info() {
$actions = array();
$actions['rules_forms_attribute_set'] = array(
'label' => t('Set a attribute of an element in the form'),
'group' => 'Rules Forms',
'parameter' => array(
'data' => array(
'type' => '*',
'label' => t('Form element attribute'),
'restriction' => 'selector',
'description' => t('Select the form element attribute to modify. You can traverse the form structure using the data selector. Element attributes are prefixed by a hash mark (#).'),
'wrapped' => TRUE,
'allow null' => TRUE,
),
'value' => array(
'type' => '*',
'label' => t('Value'),
'description' => t('The new value to set for the specified attribute. To set the <em>#options</em> attribute of a form element, <strong>Key-value pairs MUST be specified as "safe_key|Some readable option"</strong>. Use of only alphanumeric characters and underscores is recommended in keys. One option per line.'),
'allow null' => TRUE,
'optional' => TRUE,
),
),
'base' => 'rules_forms_action_attribute_set',
'callbacks' => array(
'validate' => 'rules_forms_attribute_set_validate',
'form_alter' => 'rules_forms_property_value_form_alter',
'info_alter' => 'rules_forms_action_attribute_set_info_alter',
),
);
$actions['rules_forms_set_error'] = array(
'label' => t('Set an error on the form'),
'group' => 'Rules Forms',
'parameter' => array(
// We use the 'data' and 'value' keys to support reuse of the callback.
'data' => array(
'type' => 'form_element',
'label' => t('Targeted element'),
'restriction' => 'selector',
'description' => t('Select the form element to target (if any).'),
'wrapped' => TRUE,
'allow null' => TRUE,
'optional' => TRUE,
),
'value' => array(
'type' => 'text',
'label' => t('Message'),
'optional' => TRUE,
'description' => t('The message that should be displayed to the user.'),
),
),
'base' => 'rules_forms_action_set_error',
'callbacks' => array(
'form_alter' => 'rules_forms_property_value_form_alter',
),
);
$actions['rules_forms_redirect'] = array(
'label' => t('Set the redirect target of the form'),
'group' => 'Rules Forms',
'parameter' => array(
'form_state' => array(
'type' => 'form_state',
'label' => t('Form state'),
),
'path' => array(
'type' => 'text',
'label' => t('Path'),
),
'query' => array(
'type' => 'text',
'label' => t('Query'),
'optional' => TRUE,
),
'fragment' => array(
'type' => 'text',
'label' => t('Fragment'),
'optional' => TRUE,
),
),
'base' => 'rules_forms_action_redirect',
'help' => t('Enter a Drupal path, path alias, or external URL to redirect to. Enter (optional) queries after "?" and (optional) anchor after "#".'),
);
return $actions;
}