You are here

function apachesolr_ctools_environment_export in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.module \apachesolr_ctools_environment_export()
  2. 7 apachesolr.module \apachesolr_ctools_environment_export()

Callback for exporting Apache Solr environments as CTools exportables.

Parameters

array $environment: An environment array from Apache Solr.

string $indent: White space for indentation from CTools.

1 string reference to 'apachesolr_ctools_environment_export'
apachesolr_schema in ./apachesolr.install
Implements hook_schema().

File

./apachesolr.module, line 2851
Integration with the Apache Solr search application.

Code

function apachesolr_ctools_environment_export($environment, $indent) {
  ctools_include('export');
  $environment = (object) $environment;

  // Re-load the enviroment, since in some cases the conf
  // is stripped since it's not in the actual schema.
  $environment = (object) apachesolr_environment_load($environment->env_id);
  $index_bundles = array();
  foreach (entity_get_info() as $type => $info) {
    if ($bundles = apachesolr_get_index_bundles($environment->env_id, $type)) {
      $index_bundles[$type] = $bundles;
    }
  }
  $additions_top = array();
  $additions_bottom = array(
    'conf' => $environment->conf,
    'index_bundles' => $index_bundles,
  );
  return ctools_export_object('apachesolr_environment', $environment, $indent, NULL, $additions_top, $additions_bottom);
}