localizer = $localizer; $this->searchBoxData = $searchBoxData; $this->skin = $skin; } /** * Get the keyboard hint data * @return array */ private function getKeyboardHintData() { $data = []; // There is probably a cleaner way to handle this $map = [ '↑ ↓' => $this->localizer->msg( "citizen-search-keyhint-select" )->text(), '/' => $this->localizer->msg( "citizen-search-keyhint-open" )->text(), 'Esc' => $this->localizer->msg( "citizen-search-keyhint-exit" )->text() ]; foreach ( $map as $key => $label ) { $keyhint = new CitizenComponentKeyboardHint( $label, $key ); $data[] = $keyhint->getTemplateData(); } return $data; } /** * Get the footer message * @return string */ private function getFooterMessage(): string { $isCirrusSearchExtensionEnabled = ExtensionRegistry::getInstance()->isLoaded( 'CirrusSearch' ); $searchBackend = $isCirrusSearchExtensionEnabled ? 'cirrussearch' : 'mediawiki'; return $this->localizer->msg( 'citizen-search-poweredby', $this->localizer->msg( "citizen-search-poweredby-$searchBackend" ) )->text(); } /** * @inheritDoc */ public function getTemplateData(): array { $searchBoxData = $this->searchBoxData; return $searchBoxData += [ 'array-keyboard-hint' => $this->getKeyboardHintData(), 'msg-citizen-search-footer' => $this->getFooterMessage(), 'msg-citizen-search-toggle-shortcut' => '[/]', 'html-random-href' => $this->skin->makeSpecialUrl( 'Randompage' ), ]; } }