You are here

function apachesolr_multilingual_confgen_variable_realm_variable_list_alter in Apache Solr Multilingual 7

Implements hook_variable_realm_variable_list_alter().

Prevents removal of apachesolr_multilingual variables from the list of multilingual variables.

File

apachesolr_multilingual_confgen/apachesolr_multilingual_confgen.module, line 265
Multilingual search using Apache Solr.

Code

function apachesolr_multilingual_confgen_variable_realm_variable_list_alter(&$variables, $realm_name) {
  if ('language' == $realm_name) {
    $new_variables = array_merge($variables, array_keys(apachesolr_multilingual_confgen_get_i18n_variables()), array_keys(apachesolr_multilingual_confgen_get_apachesolr_confgen_textfiles_i18n_variables()));
    $diff = array_diff($new_variables, $variables);
    if (!empty($diff)) {
      foreach ($diff as $name) {
        $info = variable_get_info($name);
        drupal_set_message(t('Variable %title has been declared as multilingual or solr version dependent by Apache Solr Multilingual and cannot be removed from the list of multilingual variables.', array(
          '%title' => $info['title'],
        )), 'error');
      }
      $variables = $new_variables;
    }
  }
}