You are here

function macro_record_macro in Macro 6

Same name and namespace in other branches
  1. 7 macro.module \macro_record_macro()

A form submission handler, that stores the form submissions into the variables table

1 call to macro_record_macro()
macro_export_action_submit in ./macro.module
Form callback to handle macro export functionality.
1 string reference to 'macro_record_macro'
macro_form_alter in ./macro.module
Implementation of hook_form_alter().

File

./macro.module, line 173
allow administrators to record (export) form submissions allow administrators to replay (import) form submissions

Code

function macro_record_macro($form, &$form_state) {
  $macros = variable_get('macro_submissions', array());

  // Remove the $form_state as it will be rebuilt on import.
  array_shift($form['#parameters']);

  // TODO: Why is it when the record method is called through the $form['#submit'] when
  // the action buttons are not displayed do these exception values not show up in the 'values' ?
  $exceptions = array(
    'export',
    'export-data',
    'export-session-data',
    'import-data',
    'form_id',
    'submit',
    'reset',
    'form_build_id',
    'form_token',
    'delete',
  );

  // Remove the unneeded values that this module implements.
  foreach ($exceptions as $exception) {
    unset($form_state['values'][$exception]);
  }
  $macro = array(
    'form_id' => $form['form_id']['#value'],
    'path' => $_GET['q'],
    'parameters' => $form['#parameters'],
    'values' => $form_state['values'],
  );

  // Support for multistep.
  if ($form_state['storage']) {
    $macro['storage'] = $form_state['storage'];
  }
  $macros[] = $macro;
  variable_set('macro_submissions', $macros);
  return $macro;
}