You are here

function msnf_step_features_export_render in Multistep Nodeform 6

Implementation of hook_features_export_render().

Render one or more component objects to code.

Parameters

<string> $module_name: The name of the feature module to be exported.

<array> $data: An array of machine name identifiers for the objects to be rendered.

<array> $export: The full export array of the current feature being exported. This is only passed when hook_features_export_render() is invoked for an actual feature update or recreate, not during state checks or other operations.

Return value

<array> An associative array of rendered PHP code where the key is the name of the hook that should wrap the PHP code. The hook should not include the name of the module, e.g. the key for `hook_example` should simply be `example`.

File

includes/msnf.features.inc, line 67
Features integration for "Multistep Nodeform".

Code

function msnf_step_features_export_render($module_name, $data, $export = NULL) {

  // Load necessary functions for form steps.
  module_load_include('inc', 'msnf', 'includes/msnf.steps');
  $steps = msnf_steps();
  $content_types = msnf_content_types();
  $code = array();
  $code[] = '  $steps = array();';
  $code[] = '';
  foreach ($data as $sys_name) {

    // Get node type and step name from sys_name.
    list($type_name, $step_name) = explode('__', $sys_name);

    // Get the step we want to export.
    if (isset($steps[$type_name]) && isset($steps[$type_name][$step_name])) {
      $code[] = '  $steps[\'' . $type_name . "']['" . $step_name . "'] = " . features_var_export($steps[$type_name][$step_name], '  ') . ';';
    }
  }
  $code[] = '  return $steps;';
  $code = implode("\n", $code);
  return array(
    'msnf_step_default_steps' => $code,
  );
}