Chris@0: getCurrentLanguage(); Chris@0: Chris@0: $result = $variables['result']; Chris@0: $variables['url'] = UrlHelper::stripDangerousProtocols($result['link']); Chris@0: $variables['title'] = $result['title']; Chris@0: if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != LanguageInterface::LANGCODE_NOT_SPECIFIED) { Chris@0: $variables['title_attributes']['lang'] = $result['language']; Chris@0: $variables['content_attributes']['lang'] = $result['language']; Chris@0: } Chris@0: Chris@0: $info = []; Chris@0: if (!empty($result['plugin_id'])) { Chris@0: $info['plugin_id'] = $result['plugin_id']; Chris@0: } Chris@0: if (!empty($result['user'])) { Chris@0: $info['user'] = $result['user']; Chris@0: } Chris@0: if (!empty($result['date'])) { Chris@0: $info['date'] = format_date($result['date'], 'short'); Chris@0: } Chris@0: if (isset($result['extra']) && is_array($result['extra'])) { Chris@0: $info = array_merge($info, $result['extra']); Chris@0: } Chris@0: // Check for existence. User search does not include snippets. Chris@0: $variables['snippet'] = isset($result['snippet']) ? $result['snippet'] : ''; Chris@0: // Provide separated and grouped meta information.. Chris@0: $variables['info_split'] = $info; Chris@0: $variables['info'] = [ Chris@0: '#type' => 'inline_template', Chris@0: '#template' => '{{ info|safe_join(" - ") }}', Chris@0: '#context' => ['info' => $info], Chris@0: ]; Chris@0: }