You are here

function search_autocomplete_config_features_export_render in Search Autocomplete 7.4

Implements hook_features_export_render().

This hook will be invoked in order to export Component hook. The hook should be implemented using the name ot the component, not the module, eg. [component]_features_export() rather than [module]_features_export().

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, for example the key for `hook_example` should simply be `example`.

File

./search_autocomplete.features.inc, line 84
Search Autocomplete Add support for CTools and feature import/export.

Code

function search_autocomplete_config_features_export_render($module_name, $data, $export = NULL) {
  $code = array();
  $i = 0;
  foreach ($data as $component) {

    //here 11it is just a variable_get, in other cases, it could be a query!
    $search_obj = search_autocomplete_row_data($component);
    foreach ($search_obj as $key => $value) {
      $code[$i][$key] = $value;
    }
    $i++;
  }
  $code = "  return " . features_var_export($code, '  ') . ";";
  return array(
    'search_autocomplete_config_features_default_settings' => $code,
  );
}