function rules_data_list_form_alter in Rules 7.2
Form alter callback for the list add and remove actions.
Use multiple steps to configure the action to update the item configuration form once we know the data type.
See also
Related topics
2 string references to 'rules_data_list_form_alter'
- rules_data_action_info in modules/
data.rules.inc - Implements hook_rules_action_info() on behalf of the pseudo data module.
- rules_data_condition_info in modules/
data.rules.inc - Implements hook_rules_condition_info() on behalf of the pseudo data module.
File
- modules/
data.rules.inc, line 351 - General data related rules integration.
Code
function rules_data_list_form_alter(&$form, &$form_state, $options, RulesAbstractPlugin $element) {
if (!empty($options['init']) && !isset($form_state['rules_element_step'])) {
unset($form['parameter']['item'], $form['parameter']['pos']);
$form_state['rules_element_step'] = 1;
$form['negate']['#access'] = FALSE;
$form['parameter']['unique']['#access'] = FALSE;
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Continue'),
'#limit_validation_errors' => array(
array(
'parameter',
'list',
),
),
'#submit' => array(
'rules_form_submit_rebuild',
),
);
}
else {
// Change the list parameter to be not editable any more.
$form['parameter']['list']['settings']['#access'] = FALSE;
$form['parameter']['list']['info'] = array(
'#prefix' => '<p>',
'#markup' => t('<strong>Selected list:</strong> %selector', array(
'%selector' => $element->settings['list:select'],
)),
'#suffix' => '</p>',
);
}
}