taxonomy_entity_index.admin.inc in Taxonomy Entity Index 7
File
taxonomy_entity_index.admin.inc
View source
<?php
function taxonomy_entity_index_admin_form() {
$entities = module_invoke_all('entity_info');
foreach ($entities as $key => $entity) {
$options[$key] = $entity['label'];
}
$form['types'] = array(
'#type' => 'checkboxes',
'#title' => t('Entity types'),
'#options' => $options,
'#description' => t('Re-index all terms for the selected entity types.'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Rebuild Index',
);
return $form;
}
function taxonomy_entity_index_admin_form_submit($form, &$form_state) {
$types = array_filter($form_state['values']['types']);
foreach ($types as $type) {
$operations[] = array(
'taxonomy_entity_index_reindex_entity_type',
array(
$type,
),
);
}
$batch = array(
'operations' => $operations,
'finished' => 'taxonomy_entity_index_reindex_finished',
'file' => drupal_get_path('module', 'taxonomy_entity_index') . '/taxonomy_entity_index.admin.inc',
);
batch_set($batch);
}