I'm building custom form rule which is having $form_state
as rule input parameter, however I would like to use drupal_form_submit()
which requires $form_id
.
Is it possible to fetch/compute automatically $form_id
based on its $form_state
to make my rule generic?
Or maybe there is some documentation that explains what $form_state
should consist exactly?
My rule is like:
/**
* Implements hook_rules_action_info().
*/
function rules_forms_rules_action_info() {
$actions['rules_forms_submit'] = array(
'label' => t('Submit the form'),
'group' => 'Rules Forms',
'parameter' => array(
'form_state' => array('type' => 'form_state', 'label' => t('Form state')),
),
'base' => 'rules_forms_action_submit',
'access callback' => 'rules_forms_integration_access',
);
return $actions;
}
/**
* Action: Submit the form.
*/
function rules_forms_action_submit($form_state) {
// $form_id = ?
drupal_form_submit($form_id, $form_state);
}
I've checked $form_state
and it's a huge (~0,5MB size-like) ArrayObject with the following main keys/properties:
build_info, temporary, programmed, programmed_bypass_access_check, cache, entityform, entityform_form_mode, field, storage, rebuild, rebuild_info, redirect, submitted, executed, method, groups, buttons, input, values, complete form, process_input, invalid_token, triggering_element, submit_handlers, clicked_button