You are here

function macro_get_macro in Macro 7

Same name and namespace in other branches
  1. 6 macro.module \macro_get_macro()

The output of this callback should be saved to the profiles/$profile/macros.inc file, to be automatically played back upon completed install.

Return value

a code representation of the recorded macro.

1 call to macro_get_macro()
macro_export_macro in ./macro.module
A form callback that displays the macro exported.

File

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

Code

function macro_get_macro() {
  $subs = variable_get('macro_submissions', array());
  $string = '';
  foreach ($subs as $key => $form) {
    $string .= "\$macro[{$key}]['form_id'] = " . var_export($form['form_id'], TRUE) . ";\n";
    $string .= "\$macro[{$key}]['path'] = " . var_export($form['path'], TRUE) . ";\n";
    $string .= "\$macro[{$key}]['values']  = " . var_export(_macro_recursively_convert_objects_to_arrays((array) $form['values']), TRUE) . ";\n";

    // Add multistep support.
    if (isset($form['storage'])) {
      $string .= "\$macro[{$key}]['storage']  = " . var_export(_macro_recursively_convert_objects_to_arrays((array) $form['storage']), TRUE) . ";\n";
    }
    if (isset($form['parameters'])) {

      // the form parameters are being used here.
      array_shift($form['parameters']);
      $string .= "\$macro[{$key}]['parameters']  = " . var_export(serialize($form['parameters']), TRUE) . ";\n\n";
    }
  }
  return $string;
}