function rules_forms_rules_condition_info in Rules Forms Support 7.2
Same name and namespace in other branches
- 7 rules_forms.rules.inc \rules_forms_rules_condition_info()
Implements hook_rules_condition_info().
File
- ./
rules_forms.rules.inc, line 51 - Rules events, conditions, and actions hooks for Rules Forms module.
Code
function rules_forms_rules_condition_info() {
$conditions = array();
// @TODO: The element has value form alter callback should display a
// form based on the type of value the element has.
$conditions['rules_forms_element_has_value'] = array(
'label' => t('Form element has value'),
'group' => 'Rules Forms',
'parameter' => array(
'data' => array(
'type' => 'form_element',
'label' => t('Form element'),
'description' => t('Select the form element to evaluate. You can traverse the form structure using the data selector.'),
'restriction' => 'selector',
'wrapped' => TRUE,
'allow null' => TRUE,
),
'value' => array(
'type' => '*',
'label' => t('Value'),
'description' => t('Value(s) assigned to the form element. If the form element allows multiple values, enter one value per line.'),
'allow null' => TRUE,
'optional' => TRUE,
),
'regex' => array(
'type' => 'boolean',
'label' => t('Evaluate as regular expression'),
'optional' => TRUE,
'description' => t('Perform the data comparison using the provided value as a regular expression. To execute multiple regular expressions, enter one expression per line.'),
),
),
'base' => 'rules_forms_condition_element_value',
'callbacks' => array(
'form_alter' => 'rules_forms_property_value_form_alter',
'info_alter' => 'rules_forms_element_value_info_alter',
),
);
$conditions['rules_forms_attribute_has_value'] = array(
'label' => t('Form element attribute has value'),
'group' => 'Rules Forms',
'parameter' => array(
'data' => array(
'type' => '*',
'label' => t('Form element attribute'),
'description' => t('Select the form element attribute to evaluate. You can traverse the form structure using the data selector. Element attributes are prefixed by a hash mark (#).'),
'restriction' => 'selector',
'wrapped' => TRUE,
'allow null' => TRUE,
),
'value' => array(
'type' => '*',
'label' => t('Value'),
'description' => t('Value(s) assigned to the form element attribute. If the form element allows multiple values, enter one value per line.'),
'allow null' => TRUE,
'optional' => TRUE,
),
'regex' => array(
'type' => 'boolean',
'label' => t('Evaluate as regular expression'),
'optional' => TRUE,
'description' => t('Perform the data comparison using the provided value as a regular expression. To execute multiple regular expressions, enter one expression per line.'),
),
),
'base' => 'rules_forms_condition_attribute_value',
'callbacks' => array(
'validate' => 'rules_forms_attribute_get_validate',
'form_alter' => 'rules_forms_property_value_form_alter',
),
);
$conditions['rules_forms_element_changed'] = array(
'label' => t('Form element value has changed'),
'group' => 'Rules Forms',
'parameter' => array(
'form_state' => array(
'type' => 'form_state',
'label' => t('Form state'),
),
'data' => array(
'type' => 'form_element',
'label' => t('Form element'),
'description' => t('Select the form element to evaluate. You can traverse the form structure using the data selector. Element attributes are prefixed by a hash mark (#).'),
'restriction' => 'selector',
'wrapped' => TRUE,
'allow null' => TRUE,
),
),
'base' => 'rules_forms_condition_element_changed',
);
$conditions['rules_forms_button_clicked'] = array(
'label' => t('Form button was clicked'),
'group' => 'Rules Forms',
'parameter' => array(
'form_state' => array(
'type' => 'form_state',
'label' => t('Form state'),
),
'data' => array(
'type' => 'form_element',
'label' => t('Form button'),
'description' => t('Select the form element to evaluate. You can traverse the form structure using the data selector. Element attributes are prefixed by a hash mark (#).'),
'restriction' => 'selector',
'wrapped' => TRUE,
'allow null' => TRUE,
),
),
'base' => 'rules_forms_condition_button_clicked',
);
return $conditions;
}