MediaWiki REL1_39
MediaWiki\Search\SearchWidgets\FullSearchResultWidget Class Reference

Renders a 'full' multi-line search result with metadata. More...

Inheritance diagram for MediaWiki\Search\SearchWidgets\FullSearchResultWidget:
Collaboration diagram for MediaWiki\Search\SearchWidgets\FullSearchResultWidget:

Public Member Functions

 __construct (SpecialSearch $specialPage, LinkRenderer $linkRenderer, HookContainer $hookContainer)
 
 render (SearchResult $result, $position)
 

Protected Member Functions

 buildMeta ( $desc, $date)
 
 generateAltTitleHtml ( $msgKey, ?Title $title, $text)
 Generates an alternate title link, such as (redirect from Foo).
 
 generateCategoryHtml (SearchResult $result)
 
 generateFileHtml (SearchResult $result)
 
 generateMainLinkHtml (SearchResult $result, $position)
 Generates HTML for the primary call to action.
 
 generateRedirectHtml (SearchResult $result)
 
 generateSectionHtml (SearchResult $result)
 
 generateSizeHtml (SearchResult $result)
 

Protected Attributes

LinkRenderer $linkRenderer
 
SpecialSearch $specialPage
 

Detailed Description

Renders a 'full' multi-line search result with metadata.

The Title some highlighted text about the search result 5 KiB (651 words) - 12:40, 6 Aug 2016

Definition at line 23 of file FullSearchResultWidget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::__construct ( SpecialSearch $specialPage,
LinkRenderer $linkRenderer,
HookContainer $hookContainer )

Member Function Documentation

◆ buildMeta()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::buildMeta ( $desc,
$date )
protected
Parameters
string$descHTML description of result, ex: size in bytes, or empty string
string$dateHTML representation of last edit date, or empty string
Returns
string HTML A div combining $desc and $date with a separator in a
. If either is missing only one will be represented. If both are missing an empty string will be returned.

Definition at line 295 of file FullSearchResultWidget.php.

Referenced by MediaWiki\Search\SearchWidgets\FullSearchResultWidget\render().

◆ generateAltTitleHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateAltTitleHtml ( $msgKey,
?Title $title,
$text )
protected

Generates an alternate title link, such as (redirect from Foo).

Parameters
string$msgKeyi18n message used to wrap title
Title | null$titleThe title to link to, or null to generate the message without a link. In that case $text must be non-null.
string | null$textThe text snippet to display, or null to use the title
Returns
string HTML

Definition at line 183 of file FullSearchResultWidget.php.

References $title.

Referenced by MediaWiki\Search\SearchWidgets\FullSearchResultWidget\generateCategoryHtml(), MediaWiki\Search\SearchWidgets\FullSearchResultWidget\generateRedirectHtml(), and MediaWiki\Search\SearchWidgets\FullSearchResultWidget\generateSectionHtml().

◆ generateCategoryHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateCategoryHtml ( SearchResult $result)
protected

◆ generateFileHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateFileHtml ( SearchResult $result)
protected
Parameters
SearchResult$result
Returns
array Three element array containing the main file html, a text description of the file, and finally the thumbnail html. If no thumbnail is available the second and third will be null.

Definition at line 254 of file FullSearchResultWidget.php.

References $title, MediaWiki\MediaWikiServices\getInstance(), and NS_FILE.

Referenced by MediaWiki\Search\SearchWidgets\FullSearchResultWidget\render().

◆ generateMainLinkHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateMainLinkHtml ( SearchResult $result,
$position )
protected

Generates HTML for the primary call to action.

It is typically the article title, but the search engine can return an exact snippet to use (typically the article title with highlighted words).

Parameters
SearchResult$result
int$position
Returns
string HTML

Definition at line 145 of file FullSearchResultWidget.php.

References MediaWiki\Search\SearchWidgets\FullSearchResultWidget\$specialPage, and $title.

Referenced by MediaWiki\Search\SearchWidgets\FullSearchResultWidget\render().

◆ generateRedirectHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateRedirectHtml ( SearchResult $result)
protected

◆ generateSectionHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateSectionHtml ( SearchResult $result)
protected

◆ generateSizeHtml()

MediaWiki\Search\SearchWidgets\FullSearchResultWidget::generateSizeHtml ( SearchResult $result)
protected
Parameters
SearchResult$result
Returns
string HTML

Definition at line 230 of file FullSearchResultWidget.php.

References $title, and NS_CATEGORY.

Referenced by MediaWiki\Search\SearchWidgets\FullSearchResultWidget\render().

◆ render()

Member Data Documentation

◆ $linkRenderer

LinkRenderer MediaWiki\Search\SearchWidgets\FullSearchResultWidget::$linkRenderer
protected

◆ $specialPage

SpecialSearch MediaWiki\Search\SearchWidgets\FullSearchResultWidget::$specialPage
protected

The documentation for this class was generated from the following file: