|
| 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-api-page-results.tpl.php. This and the parent template are dependent |
| 8 | + * on one another, sharing the markup for definition lists. |
| 9 | + * |
| 10 | + * View mode is set in the Search page settings. If you select |
| 11 | + * "Themed as search results", then this template will be used for theming the |
| 12 | + * individual results. Any other view mode will bypass this template. |
| 13 | + * |
| 14 | + * Available variables: |
| 15 | + * - $index: The search index this search is based on. |
| 16 | + * - $url: URL of the result. |
| 17 | + * - $title: Title of the result (unsanitized). |
| 18 | + * - $snippet: A small preview of the result. |
| 19 | + * - $info: String of all the meta information ready for print. Applies |
| 20 | + * only if the result is a node. |
| 21 | + * - $info_split: Contains same data as $info, split into a keyed array. |
| 22 | + * - $classes: CSS classes for this list element. |
| 23 | + * |
| 24 | + * Default keys within $info_split: |
| 25 | + * - $info_split['user']: Author of the entity, where an author exists. |
| 26 | + * Depends on permission. |
| 27 | + * - $info_split['date']: Last update of the entity, if the 'updated' |
| 28 | + * field exists. Short formatted. |
| 29 | + * |
| 30 | + * Since $info_split is keyed, a direct print of the item is possible. |
| 31 | + * This array applies where the search result is a node, so it is |
| 32 | + * recommended to check for its existence before printing. |
| 33 | + * Where the result is a node, the default keys of 'user' and 'date' |
| 34 | + * will always exist. |
| 35 | + * |
| 36 | + * To check for all available data within $info_split, use the code below. |
| 37 | + * @code |
| 38 | + * <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?> |
| 39 | + * @endcode |
| 40 | + * |
| 41 | + * @see template_preprocess_search_api_page_result() |
| 42 | + */ |
| 43 | +?> |
| 44 | +<li class="search-result"> |
| 45 | + <h3 class="title"> |
| 46 | + <?php print $url ? l($title, $url['path'], $url['options']) : check_plain($title); ?> |
| 47 | + </h3> |
| 48 | + <div class="search-snippet-info"> |
| 49 | + <?php if ($snippet) : ?> |
| 50 | + <p class="search-snippet"><?php print strip_tags($snippet,'<strong>'); ?></p> |
| 51 | + <?php endif; ?> |
| 52 | + <?php if ($info) : ?> |
| 53 | + <p class="search-info"><?php print $info; ?></p> |
| 54 | + <?php endif; ?> |
| 55 | + </div> |
| 56 | +</li> |
0 commit comments