You are here

function custom_search_update_7103 in Custom Search 7

Changes in the advanced search form settings.

File

./custom_search.install, line 66
Install, update, and uninstall functions for the custom search module.

Code

function custom_search_update_7103() {
  if (variable_get('custom_search_results_advanced_override', FALSE)) {
    variable_set('custom_search_advanced_or_display', variable_get('custom_search_criteria_or_display', FALSE));
    variable_set('custom_search_advanced_phrase_display', variable_get('custom_search_criteria_phrase_display', FALSE));
    variable_set('custom_search_advanced_negative_display', variable_get('custom_search_criteria_negative_display', FALSE));
    $types = array_keys(array_filter(variable_get('custom_search_node_types', array())));
    if (count($types)) {
      $names = array_keys(node_type_get_names());
      foreach ($names as $name) {
        if (!in_array($name, $types)) {
          variable_set('custom_search_advanced_type_' . $name . '_display', FALSE);
        }
      }
    }
    if (module_exists('taxonomy')) {
      $vocabularies = taxonomy_get_vocabularies();
      foreach ($vocabularies as $voc) {
        if (variable_get('custom_search_voc' . $voc->vid . '_selector', 'disabled') == 'disabled') {
          variable_set('custom_search_advanced_voc' . $voc->vid . '_display', FALSE);
        }
      }
    }
  }
  variable_del('custom_search_results_advanced_override');
  return t('Advanced search form settings changed.');
}