edlp_search.module 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Contains edlp_search.module.
  5. */
  6. use Drupal\Core\Routing\RouteMatchInterface;
  7. use Drupal\Core\Url;
  8. /**
  9. * Implements hook_help().
  10. */
  11. function edlp_search_help($route_name, RouteMatchInterface $route_match) {
  12. switch ($route_name) {
  13. // Main module help for the edlp_search module.
  14. case 'help.page.edlp_search':
  15. $output = '';
  16. $output .= '<h3>' . t('About') . '</h3>';
  17. $output .= '<p>' . t('Edlp search module') . '</p>';
  18. return $output;
  19. default:
  20. }
  21. }
  22. /**
  23. * Implements hook_page_attachments().
  24. * @param array $attachments
  25. */
  26. function edlp_search_page_attachments(array &$attachments) {
  27. $attachments['#attached']['library'][] = 'edlp_search/edlp_search-library';
  28. $url = Url::fromRoute('edlp_search.edlp_search_controller_search_results_ajax');
  29. $attachments['#attached']['drupalSettings']['edlp_search']['results_ajax_url'] = $url->getInternalPath();
  30. }
  31. /**
  32. * Implements hook_theme().
  33. */
  34. function edlp_search_theme($existing, $type, $theme, $path) {
  35. return array(
  36. 'edlp_search_search_form' => array(
  37. 'file' => 'includes/edlp_search_search_form.inc',
  38. 'variables' => array(
  39. 'form' => null,
  40. ),
  41. ),
  42. 'edlp_search_results' => array(
  43. 'file' => 'includes/edlp_search_results.inc',
  44. 'variables' => array(
  45. 'items' => null,
  46. 'no_results_found' => '',
  47. 'search_help' => ''
  48. ),
  49. ),
  50. );
  51. }