49
materio_search_api.admin.inc
Normal file
49
materio_search_api.admin.inc
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
function materio_search_api_settings(){
|
||||
$indexes = search_api_index_load_multiple(false);
|
||||
// dsm($indexes, '$indexes');
|
||||
|
||||
foreach ($indexes as $machine_name => $index) {
|
||||
if($index->status == 1)
|
||||
$index_options[$index->machine_name] = $index->name;
|
||||
}
|
||||
|
||||
$form['mainsearchindex'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('mainsearchindex', -1),
|
||||
'#title' => t('Main search api index'),
|
||||
);
|
||||
|
||||
$form['autocompletesearchindex'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('autocompletesearchindex', -1),
|
||||
'#title' => t('Autocomplete search api index'),
|
||||
);
|
||||
|
||||
// TODO: select the activated viewmodes for change view mode and selected view mode
|
||||
$entity_infos = entity_get_info();
|
||||
// dsm($entity_infos, 'entity_infos');
|
||||
foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
|
||||
$viewmode_options[$viewmode] = $value['label'];
|
||||
}
|
||||
|
||||
$form['availableviewmodes'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$viewmode_options,
|
||||
'#default_value' => variable_get('availableviewmodes', -1),
|
||||
'#title' => t('Availble View modes'),
|
||||
'#multiple' => true,
|
||||
);
|
||||
|
||||
$form['defaultviewmode'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$viewmode_options,
|
||||
'#default_value' => variable_get('defaultviewmode', 'full'),
|
||||
'#title' => t('Defalut View mode'),
|
||||
);
|
||||
|
||||
return system_settings_form($form);
|
||||
}
|
||||
Reference in New Issue
Block a user