function rules_action_data_set_form_alter in Rules 7.2
Form alter callback for the data_set action.
Related topics
File
- modules/
data.rules.inc, line 290 - General data related rules integration.
Code
function rules_action_data_set_form_alter(&$form, &$form_state, $options, RulesAbstractPlugin $element) {
if (!empty($options['init']) && !isset($form_state['rules_element_step'])) {
$form['negate']['#access'] = FALSE;
unset($form['parameter']['value']);
unset($form['parameter']['language']);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Continue'),
'#limit_validation_errors' => array(
array(
'parameter',
'data',
),
),
'#submit' => array(
'rules_form_submit_rebuild',
),
);
$form_state['rules_element_step'] = 'data_value';
// Clear the parameter mode for the value parameter, so its gets the proper
// default value based upon the type of the selected data on rebuild.
unset($form_state['parameter_mode']['value']);
}
else {
// Change the data parameter to be not editable.
$form['parameter']['data']['settings']['#access'] = FALSE;
// @todo Improve display.
$form['parameter']['data']['info'] = array(
'#prefix' => '<p>',
'#markup' => t('<strong>Selected data:</strong> %selector', array(
'%selector' => $element->settings['data:select'],
)),
'#suffix' => '</p>',
);
}
}