function search_autocomplete_update_7411 in Search Autocomplete 7.4
Migrate no_results and all_results fields from 4.0 to 4.1 default values
File
- ./
search_autocomplete.install, line 400 - This file is used to install/update/delete the module tables in database
Code
function search_autocomplete_update_7411(&$sandbox) {
if (!db_field_exists('search_autocomplete_forms', 'no_results')) {
$field = array(
'description' => 'Display field when no suggestion available.',
'type' => 'text',
'size' => 'big',
);
db_add_field('search_autocomplete_forms', 'no_results', $field);
}
else {
db_change_field('search_autocomplete_forms', 'no_results', 'no_results', array(
'description' => 'Display field when no suggestion available.',
'type' => 'text',
'size' => 'big',
));
}
db_update('search_autocomplete_forms')
->fields(array(
'no_results' => json_encode(array(
'label' => t('No results found for [search-phrase]. Click to perform full search.'),
'value' => '[search-phrase]',
'link' => '',
'group' => array(
'group_id' => 'no_results',
),
)),
))
->execute();
if (!db_field_exists('search_autocomplete_forms', 'all_results')) {
$field = array(
'description' => 'Display field when some suggestion are available.',
'type' => 'text',
'size' => 'big',
);
db_add_field('search_autocomplete_forms', 'all_results', $field);
}
db_update('search_autocomplete_forms')
->fields(array(
'all_results' => json_encode(array(
'label' => t('View all results for [search-phrase].'),
'value' => '[search-phrase]',
'link' => '',
'group' => array(
'group_id' => 'all_results',
),
)),
))
->execute();
}