function rules_forms_rules_action_info in Rules Forms Support 7
Same name and namespace in other branches
- 7.2 rules_forms.rules.inc \rules_forms_rules_action_info()
Implements hook_rules_action_info().
File
- ./
rules_forms.rules.inc, line 236 - Rules events, conditions, and actions hooks for Rules Forms module.
Code
function rules_forms_rules_action_info() {
$element_params = array(
'form' => array(
'type' => 'form',
'label' => t('Form'),
),
'element' => array(
'type' => 'form_element',
'label' => t('Form element'),
'restriction' => 'input',
'description' => t('The form element to be targeted.'),
),
);
$actions = array();
$actions['rules_forms_set_title'] = array(
'label' => t('Set the title of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'title' => array(
'type' => 'text',
'label' => t('Title'),
'optional' => TRUE,
),
),
'base' => 'rules_forms_action_set_title',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_description'] = array(
'label' => t('Set the description of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'description' => array(
'type' => 'text',
'label' => t('Description'),
'optional' => TRUE,
),
),
'base' => 'rules_forms_action_set_description',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_access'] = array(
'label' => t('Hide an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'access' => array(
'type' => 'boolean',
'label' => t('Hide'),
'optional' => TRUE,
'description' => t('Hides a form element.'),
),
),
'base' => 'rules_forms_action_set_access',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_disabled'] = array(
'label' => t('Disable an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'disabled' => array(
'type' => 'boolean',
'label' => t('Disable'),
'optional' => TRUE,
'description' => t('Disables a form element.'),
),
),
'base' => 'rules_forms_action_set_disabled',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_required'] = array(
'label' => t('Require an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'require' => array(
'type' => 'boolean',
'label' => t('Required'),
'optional' => TRUE,
'description' => t('Requires a form element.'),
),
),
'base' => 'rules_forms_action_set_required',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_options'] = array(
'label' => t('Set multiple value options of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'options' => array(
'type' => 'text',
'label' => t('Options'),
'description' => t('<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.'),
),
),
'base' => 'rules_forms_action_set_options',
'validate' => 'rules_forms_action_set_options_validate',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_default'] = array(
'label' => t('Set the default value of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'value' => array(
'type' => 'form_value',
'label' => t('Value(s)'),
'optional' => TRUE,
'description' => t('Value(s) to assign to the form element. If the form element allows multiple values, enter one value per line.'),
),
),
'base' => 'rules_forms_action_set_default',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_weight'] = array(
'label' => t('Adjust weight of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'weight' => array(
'type' => 'integer',
'label' => t('Element weight'),
'options list' => '_rules_forms_weight_options',
'description' => t('Low numbers make the element bubble up, high numbers sink it down.'),
),
),
'base' => 'rules_forms_action_set_weight',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_prefix_suffix'] = array(
'label' => t('Insert HTML into the prefix/suffix of an element in the form'),
'group' => 'Rules Forms',
'parameter' => $element_params + array(
'prefix' => array(
'type' => 'text',
'label' => t('Prefixed HTML'),
'optional' => TRUE,
'description' => t('HTML inserted before the element.'),
),
'suffix' => array(
'type' => 'text',
'label' => t('Suffixed HTML'),
'optional' => TRUE,
'description' => t('HTML inserted after the element.'),
),
),
'base' => 'rules_forms_action_set_prefix_suffix_html',
'callbacks' => array(
'access' => 'rules_forms_integration_access',
'form_alter' => 'rules_forms_element_form_alter',
),
);
$actions['rules_forms_set_error'] = array(
'label' => t('Set an error on the form'),
'group' => 'Rules Forms',
'parameter' => array(
'form' => array(
'type' => 'form',
'label' => t('Form'),
),
'element' => array(
'type' => 'form_element',
'label' => t('Form element'),
'restriction' => 'input',
'optional' => TRUE,
'description' => t('The form element to be targeted.'),
),
'message' => 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',
'access callback' => 'rules_forms_integration_access',
);
$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',
'access callback' => 'rules_forms_integration_access',
'help' => t('Enter a Drupal path, path alias, or external URL to redirect to. Enter (optional) queries after "?" and (optional) anchor after "#".'),
);
return $actions;
}