You are here

function acquia_search_install in Acquia Connector 7

Same name and namespace in other branches
  1. 8.2 acquia_search/acquia_search.install \acquia_search_install()
  2. 8 acquia_search/acquia_search.install \acquia_search_install()
  3. 7.2 acquia_search/acquia_search.install \acquia_search_install()

Implementation of hook_install().

File

acquia_search/acquia_search.install, line 60

Code

function acquia_search_install() {
  return;
  $facets = _acquia_search_get_default_facets();

  //apachesolr_save_enabled_facets(ACQUIA_SEARCH_ENVIRONMENT_ID, $facets);
  $theme_key = variable_get('theme_default', 'bartik');
  $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/config/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'] = DRUPAL_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_query("SELECT 1 FROM {block} WHERE theme = ':theme' AND module = ':module' AND delta = ':delta'", array(
      ':theme' => $block['theme'],
      ':module' => $block['module'],
      ':delta' => $block['delta'],
    ))
      ->fetchField()) {
      drupal_write_record('blocks', $block);
    }
  }
}