Chris@0
|
1 {#
|
Chris@0
|
2 /**
|
Chris@0
|
3 * @file
|
Chris@0
|
4 * Theme override for displaying a single search result.
|
Chris@0
|
5 *
|
Chris@0
|
6 * This template renders a single search result. The list of results is
|
Chris@0
|
7 * rendered using '#theme' => 'item_list', with suggestions of:
|
Chris@0
|
8 * - item_list__search_results__(plugin_id)
|
Chris@0
|
9 * - item_list__search_results
|
Chris@0
|
10 *
|
Chris@0
|
11 * Available variables:
|
Chris@0
|
12 * - url: URL of the result.
|
Chris@0
|
13 * - title: Title of the result.
|
Chris@0
|
14 * - snippet: A small preview of the result. Does not apply to user searches.
|
Chris@0
|
15 * - info: String of all the meta information ready for print. Does not apply
|
Chris@0
|
16 * to user searches.
|
Chris@0
|
17 * - plugin_id: The machine-readable name of the plugin being executed,such
|
Chris@0
|
18 * as "node_search" or "user_search".
|
Chris@0
|
19 * - title_prefix: Additional output populated by modules, intended to be
|
Chris@0
|
20 * displayed in front of the main title tag that appears in the template.
|
Chris@0
|
21 * - title_suffix: Additional output populated by modules, intended to be
|
Chris@0
|
22 * displayed after the main title tag that appears in the template.
|
Chris@0
|
23 * - info_split: Contains same data as info, but split into separate parts.
|
Chris@0
|
24 * - info_split.type: Node type (or item type string supplied by module).
|
Chris@0
|
25 * - info_split.user: Author of the node linked to users profile. Depends
|
Chris@0
|
26 * on permission.
|
Chris@0
|
27 * - info_split.date: Last update of the node. Short formatted.
|
Chris@0
|
28 * - info_split.comment: Number of comments output as "% comments", %
|
Chris@0
|
29 * being the count. (Depends on comment.module).
|
Chris@0
|
30 * @todo The info variable needs to be made drillable and each of these sub
|
Chris@0
|
31 * items should instead be within info and renamed info.foo, info.bar, etc.
|
Chris@0
|
32 *
|
Chris@0
|
33 * Other variables:
|
Chris@0
|
34 * - title_attributes: HTML attributes for the title.
|
Chris@0
|
35 * - content_attributes: HTML attributes for the content.
|
Chris@0
|
36 *
|
Chris@0
|
37 * Since info_split is keyed, a direct print of the item is possible.
|
Chris@0
|
38 * This array does not apply to user searches so it is recommended to check
|
Chris@0
|
39 * for its existence before printing. The default keys of 'type', 'user' and
|
Chris@0
|
40 * 'date' always exist for node searches. Modules may provide other data.
|
Chris@0
|
41 * @code
|
Chris@0
|
42 * {% if (info_split.comment) %}
|
Chris@0
|
43 * <span class="info-comment">
|
Chris@0
|
44 * {{ info_split.comment }}
|
Chris@0
|
45 * </span>
|
Chris@0
|
46 * {% endif %}
|
Chris@0
|
47 * @endcode
|
Chris@0
|
48 *
|
Chris@0
|
49 * To check for all available data within info_split, use the code below.
|
Chris@0
|
50 * @code
|
Chris@0
|
51 * <pre>
|
Chris@0
|
52 * {{ dump(info_split) }}
|
Chris@0
|
53 * </pre>
|
Chris@0
|
54 * @endcode
|
Chris@0
|
55 *
|
Chris@0
|
56 * @see template_preprocess_search_result()
|
Chris@0
|
57 */
|
Chris@0
|
58 #}
|
Chris@0
|
59 {{ attach_library('classy/search-results') }}
|
Chris@0
|
60 {{ title_prefix }}
|
Chris@0
|
61 <h3{{ title_attributes.addClass('search-result__title') }}>
|
Chris@0
|
62 <a href="{{ url }}">{{ title }}</a>
|
Chris@0
|
63 </h3>
|
Chris@0
|
64 {{ title_suffix }}
|
Chris@0
|
65 <div class="search-result__snippet-info">
|
Chris@0
|
66 {% if snippet %}
|
Chris@0
|
67 <p{{ content_attributes.addClass('search-result__snippet') }}>{{ snippet }}</p>
|
Chris@0
|
68 {% endif %}
|
Chris@0
|
69 {% if info %}
|
Chris@0
|
70 <p class="search-result__info">{{ info }}</p>
|
Chris@0
|
71 {% endif %}
|
Chris@0
|
72 </div>
|