In the example hook_features_export_render() (in features.api.php,) the second-to-last line tries to implode $mycomponents, which doesn't exist in the context of the function:

<?php
function hook_features_export_render($module_name, $data, $export = NULL) {
  $code = array();
  $code[] = '$mycomponents = array();';
  foreach ($data as $name) {
    $code[] = "  \$mycomponents['{$name}'] = " . features_var_export(mycomponent_load($name)) .";";
  }
  $code[] = "return \$mycomponents;";
  $code = implode("\n", $mycomponents);
  return array('mycomponent_defaults' => $code);
}
?>

...
It should really be imploding $code:

-  $code = implode("\n", $mycomponents);
+  $code = implode("\n", $code);
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeffschuler’s picture

Status: Active » Needs review
FileSize
495 bytes
mpotter’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

Easy one. Committed and pushed to 22502b0.

jeffschuler’s picture

Great; thanks for reviewing and committing!
Commit authorship credit is always appreciated, too. :)

  • mpotter committed 22502b0 on 8.x-3.x
    Issue #1564864 by jeffschuler: Fixed Mixup in...
kenorb’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.