function rules_action_callback_form in Rules 6
The configuration form callback for an action.
It should be placed into the file MODULENAME.rules_forms.inc or into MODULENAME.rules.inc.
This callback can be used to alter the automatically generated configuration form. New form elements should be put in $form['settings'] as its form values are used to populate $settings automatically. If some postprocessing of the values is necessary the action may implement rules_action_callback_submit().
Parameters
$settings: The array of configuration settings to edit. This array is going to be passed to the action implementation once executed.
$form: The configuration form as generated by rules. The modify it, has to be taken by reference. Additional form elements should go into $form['settings']. To let rules know about additional textual form elements use the 'eval input' attribute of hook_rules_action_info() so rules adds input evaluation support to them.
$form_state: The form's form state.
See also
rules_action_callback_validate(), rules_action_callback_submit()
Related topics
File
- rules/
rules.api.php, line 183 - This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
Code
function rules_action_callback_form($settings, &$form) {
$settings += array(
'type' => array(),
);
$form['settings']['type'] = array(
'#type' => 'select',
'#title' => t('Content types'),
'#options' => node_get_types('names'),
'#multiple' => TRUE,
'#default_value' => $settings['type'],
'#required' => TRUE,
);
}