PageRenderTime 56ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/search/search-result.tpl.php

https://bitbucket.org/hjain/trinet
PHP | 79 lines | 17 code | 1 blank | 61 comment | 2 complexity | a3695ed671565dfc7714386e971c4bf9 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0, AGPL-1.0
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation for displaying a single search result.
  5. *
  6. * This template renders a single search result and is collected into
  7. * search-results.tpl.php. This and the parent template are
  8. * dependent to one another sharing the markup for definition lists.
  9. *
  10. * Available variables:
  11. * - $url: URL of the result.
  12. * - $title: Title of the result.
  13. * - $snippet: A small preview of the result. Does not apply to user searches.
  14. * - $info: String of all the meta information ready for print. Does not apply
  15. * to user searches.
  16. * - $info_split: Contains same data as $info, split into a keyed array.
  17. * - $module: The machine-readable name of the module (tab) being searched, such
  18. * as "node" or "user".
  19. * - $title_prefix (array): An array containing additional output populated by
  20. * modules, intended to be displayed in front of the main title tag that
  21. * appears in the template.
  22. * - $title_suffix (array): An array containing additional output populated by
  23. * modules, intended to be displayed after the main title tag that appears in
  24. * the template.
  25. *
  26. * Default keys within $info_split:
  27. * - $info_split['type']: Node type (or item type string supplied by module).
  28. * - $info_split['user']: Author of the node linked to users profile. Depends
  29. * on permission.
  30. * - $info_split['date']: Last update of the node. Short formatted.
  31. * - $info_split['comment']: Number of comments output as "% comments", %
  32. * being the count. Depends on comment.module.
  33. *
  34. * Other variables:
  35. * - $classes_array: Array of HTML class attribute values. It is flattened
  36. * into a string within the variable $classes.
  37. * - $title_attributes_array: Array of HTML attributes for the title. It is
  38. * flattened into a string within the variable $title_attributes.
  39. * - $content_attributes_array: Array of HTML attributes for the content. It is
  40. * flattened into a string within the variable $content_attributes.
  41. *
  42. * Since $info_split is keyed, a direct print of the item is possible.
  43. * This array does not apply to user searches so it is recommended to check
  44. * for its existence before printing. The default keys of 'type', 'user' and
  45. * 'date' always exist for node searches. Modules may provide other data.
  46. * @code
  47. * <?php if (isset($info_split['comment'])): ?>
  48. * <span class="info-comment">
  49. * <?php print $info_split['comment']; ?>
  50. * </span>
  51. * <?php endif; ?>
  52. * @endcode
  53. *
  54. * To check for all available data within $info_split, use the code below.
  55. * @code
  56. * <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
  57. * @endcode
  58. *
  59. * @see template_preprocess()
  60. * @see template_preprocess_search_result()
  61. * @see template_process()
  62. */
  63. ?>
  64. <li class="<?php print $classes; ?>"<?php print $attributes; ?>>
  65. <?php print render($title_prefix); ?>
  66. <h3 class="title"<?php print $title_attributes; ?>>
  67. <a href="<?php print $url; ?>"><?php print $title; ?></a>
  68. </h3>
  69. <?php print render($title_suffix); ?>
  70. <div class="search-snippet-info">
  71. <?php if ($snippet): ?>
  72. <p class="search-snippet"<?php print $content_attributes; ?>><?php print $snippet; ?></p>
  73. <?php endif; ?>
  74. <?php if ($info): ?>
  75. <p class="search-info"><?php print $info; ?></p>
  76. <?php endif; ?>
  77. </div>
  78. </li>