function acquia_search_install in Acquia Search 6
Same name and namespace in other branches
- 6.3 acquia_search.install \acquia_search_install()
- 3.x acquia_search.install \acquia_search_install()
- 2.x acquia_search.install \acquia_search_install()
Implementation of hook_install().
File
- ./
acquia_search.install, line 56
Code
function acquia_search_install() {
$facets = _acquia_search_get_default_facets();
variable_set('apachesolr_enabled_facets', $facets);
$theme_key = variable_get('theme_default', 'garland');
$block_regions = array_keys(system_region_list($theme_key));
$region = _acquia_search_find_block_region($block_regions);
if (empty($region)) {
drupal_set_message(t('We were unable to auto-detect where to put the filter blocks for your faceted search engine. To get started adding blocks, go to the <a href="@active_filter_config_form">filter configuration screen</a>.', array(
'@active_filter_config_form' => url('admin/settings/apachesolr/active_filters'),
)));
return;
}
foreach ($facets['apachesolr_search'] as $delta => $facet_field) {
$blocks[] = array(
'module' => 'apachesolr_search',
'delta' => $delta,
);
}
$blocks[] = array(
'module' => 'apachesolr',
'delta' => 'sort',
'weight' => -1,
);
foreach ($blocks as $block) {
$block['cache'] = BLOCK_CACHE_PER_PAGE;
$block['theme'] = $theme_key;
$block['region'] = $region;
$block['status'] = 1;
// {block}.pages is type 'text', so it cannot have a
// default value, and is not null, so we must provide one.
$block['pages'] = '';
// Make sure the block does not already exist.
if (!db_result(db_query("SELECT 1 FROM {blocks} WHERE theme = '%s' AND module = '%s' AND delta = '%s'", $block['theme'], $block['module'], $block['delta']))) {
drupal_write_record('blocks', $block);
}
}
}