materio_search_api.admin.inc 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. function materio_search_api_settings(){
  3. $indexes = search_api_index_load_multiple(false);
  4. // dsm($indexes, '$indexes');
  5. foreach ($indexes as $machine_name => $index) {
  6. if($index->enabled == 1)
  7. $index_options[$index->machine_name] = $index->name;
  8. }
  9. $languages = locale_language_list();
  10. // dsm($languages, 'languages');
  11. foreach ($languages as $lcode => $name) {
  12. $form['fulltextsearchindex_'.$lcode] = array(
  13. '#type'=>'select',
  14. '#options'=>$index_options,
  15. '#default_value' => variable_get('fulltextsearchindex_'.$lcode, -1),
  16. '#title' => t('Full text search api index for %lang contents.', array('%lang'=>$name)),
  17. );
  18. $form['taxonomysearchindex_'.$lcode] = array(
  19. '#type'=>'select',
  20. '#options'=>$index_options,
  21. '#default_value' => variable_get('taxonomysearchindex_'.$lcode, -1),
  22. '#title' => t('Taxonomy search api index for %lang contents.', array('%lang'=>$name)),
  23. );
  24. $form['brevessearchindex_'.$lcode] = array(
  25. '#type'=>'select',
  26. '#options'=>$index_options,
  27. '#default_value' => variable_get('brevessearchindex_'.$lcode, -1),
  28. '#title' => t('Breves search api index for %lang contents.', array('%lang'=>$name)),
  29. );
  30. $form['autocompletesearchindex_'.$lcode] = array(
  31. '#type'=>'select',
  32. '#options'=>$index_options,
  33. '#default_value' => variable_get('autocompletesearchindex_'.$lcode, -1),
  34. '#title' => t('Autocomplete search api index for %lang contents.', array('%lang'=>$name)),
  35. );
  36. }
  37. // TODO: select the activated viewmodes for change view mode and selected view mode
  38. $entity_infos = entity_get_info();
  39. // dsm($entity_infos, 'entity_infos');
  40. foreach ($entity_infos['node']['view modes'] as $viewmode => $value) {
  41. $viewmode_options[$viewmode] = $value['label'];
  42. }
  43. $form['availableviewmodes'] = array(
  44. '#type'=>'select',
  45. '#options'=>$viewmode_options,
  46. '#default_value' => variable_get('availableviewmodes', array()),
  47. '#title' => t('Availble View modes'),
  48. '#multiple' => true,
  49. );
  50. $form['defaultviewmode'] = array(
  51. '#type'=>'select',
  52. '#options'=>$viewmode_options,
  53. '#default_value' => variable_get('defaultviewmode', 'full'),
  54. '#title' => t('Defalut View mode'),
  55. );
  56. foreach (variable_get('availableviewmodes', array()) as $viewmode => $value) {
  57. $form[$viewmode.'_limite'] = array(
  58. '#type'=>'textfield',
  59. '#size'=>5,
  60. '#default_value' => variable_get($viewmode.'_limite', '10'),
  61. '#title' => t('@vm limite', array('@vm'=>$viewmode)),
  62. );
  63. }
  64. return system_settings_form($form);
  65. }