function apachesolr_node_type_insert in Apache Solr Search 8
Same name and namespace in other branches
- 7 apachesolr.module \apachesolr_node_type_insert()
Implements hook_node_type_insert().
Insert our new type into all the environments as indexable bundle type
Parameters
array $info:
File
- ./
apachesolr.module, line 797 - Integration with the Apache Solr search application.
Code
function apachesolr_node_type_insert($info) {
module_load_include('inc', 'apachesolr', 'apachesolr.index');
// Get all our environments
$envs = apachesolr_load_all_environments();
$bundles = array();
foreach ($envs as $env) {
if (isset($env['index_bundles']['node'])) {
$bundles = $env['index_bundles']['node'];
}
// Is the bundle already marked?
if (!in_array($info->type, $bundles)) {
$bundles[] = $info->type;
// Set the new bundle as indexable for all environments
apachesolr_index_set_bundles($env['env_id'], 'node', $bundles);
}
}
}