You are here

function filefield_paths_features_export_render in File (Field) Paths 6

Implements hook_features_export_render()

Return the PHP code that represents a dump of the settings listed as $data

File

modules/features.inc, line 156
Features module integration.

Code

function filefield_paths_features_export_render($module, $data) {
  $code = array();
  $code[] = '  $settings = array();';
  $code[] = '';
  $translatables = array();
  foreach ($data as $item_id) {
    $item = filefield_paths_load($item_id);
    if (empty($item)) {
      watchdog('filefield_paths', "Failed to retrieve the filefield path settings '%item_id' while preparing the feature export code.", array(
        '%item_id' => $item_id,
      ), WATCHDOG_WARNING);
      continue;
    }
    $code[] = "  // Exported {$item_id}";
    $export = features_var_export($item, '  ');
    $code[] = "  \$settings['{$item_id}'] = {$export};";
  }
  $code[] = '';
  $code[] = '  return $settings;';
  $code = implode("\n", $code);
  return array(
    'default_filefield_paths' => $code,
  );
}