function search_api_et_install in Search API Entity Translation 7.2
Implements hook_install().
Creates a default multilingual node index if the module is installed manually.
File
- ./
search_api_et.install, line 49 - Install, update and uninstall functions for the Search API ET module.
Code
function search_api_et_install() {
// In case the module is installed via an installation profile, a batch is
// active and we skip that.
if (batch_get()) {
return;
}
$name = 'Default multilingual node index';
$values = array(
'name' => st($name),
'machine_name' => preg_replace('/[^a-z0-9]+/', '_', drupal_strtolower($name)),
'description' => st('An automatically created search index for indexing multilingual node data. Might be configured to specific needs.'),
'server' => NULL,
'item_type' => 'search_api_et_node',
'options' => array(
'index_directly' => 1,
'cron_limit' => '50',
'data_alter_callbacks' => array(
'search_api_alter_node_access' => array(
'status' => 1,
'weight' => '0',
'settings' => array(),
),
),
'processors' => array(
'search_api_case_ignore' => array(
'status' => 1,
'weight' => '0',
'settings' => array(
'strings' => 0,
),
),
'search_api_html_filter' => array(
'status' => 1,
'weight' => '10',
'settings' => array(
'title' => 0,
'alt' => 1,
'tags' => "h1 = 5\n" . "h2 = 3\n" . "h3 = 2\n" . "strong = 2\n" . "b = 2\n" . "em = 1.5\n" . "u = 1.5",
),
),
'search_api_tokenizer' => array(
'status' => 1,
'weight' => '20',
'settings' => array(
'spaces' => '[^\\p{L}\\p{N}]',
'ignorable' => '[-]',
),
),
),
'fields' => array(
'type' => array(
'type' => 'string',
),
'title' => array(
'type' => 'text',
'boost' => '5.0',
),
'promote' => array(
'type' => 'boolean',
),
'sticky' => array(
'type' => 'boolean',
),
'created' => array(
'type' => 'date',
),
'changed' => array(
'type' => 'date',
),
'author' => array(
'type' => 'integer',
'entity_type' => 'user',
),
'comment_count' => array(
'type' => 'integer',
),
'search_api_language' => array(
'type' => 'string',
),
'body:value' => array(
'type' => 'text',
),
),
),
);
search_api_index_insert($values);
drupal_set_message(st('The Search API Entity Translation module was installed. A new default multilingual node index was created.'));
}