MediaWiki  master
MediaWiki\Search\SearchWidgets\SearchFormWidget Class Reference
Collaboration diagram for MediaWiki\Search\SearchWidgets\SearchFormWidget:

Public Member Functions

 __construct (SpecialSearch $specialSearch, SearchEngineConfig $searchConfig, HookContainer $hookContainer, array $profiles)
 
 render ( $profile, $term, $numResults, $totalResults, $offset, $isPowerSearch, array $options=[])
 

Protected Member Functions

 getHookContainer ()
 
 getHookRunner ()
 
 makeSearchLink ( $term, $label, $tooltip, array $params=[])
 Make a search link with some target namespaces. More...
 
 optionsHtml ( $term, $isPowerSearch, $profile)
 Generates HTML for advanced options available with the currently selected search profile. More...
 
 powerSearchBox ( $term, array $opts)
 
 profileTabsHtml ( $profile, $term)
 Generates HTML for the list of available search profiles. More...
 
 shortDialogHtml ( $profile, $term, $numResults, $totalResults, $offset, array $options=[])
 
 startsWithImage ( $term)
 Check if query starts with image: prefix. More...
 

Protected Attributes

array $profiles
 
SearchEngineConfig $searchConfig
 
SpecialSearch $specialSearch
 

Private Attributes

 $hookContainer
 
HookRunner $hookRunner
 

Detailed Description

Definition at line 14 of file SearchFormWidget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Search\SearchWidgets\SearchFormWidget::__construct ( SpecialSearch  $specialSearch,
SearchEngineConfig  $searchConfig,
HookContainer  $hookContainer,
array  $profiles 
)

Member Function Documentation

◆ getHookContainer()

MediaWiki\Search\SearchWidgets\SearchFormWidget::getHookContainer ( )
protected

◆ getHookRunner()

MediaWiki\Search\SearchWidgets\SearchFormWidget::getHookRunner ( )
protected

◆ makeSearchLink()

MediaWiki\Search\SearchWidgets\SearchFormWidget::makeSearchLink (   $term,
  $label,
  $tooltip,
array  $params = [] 
)
protected

Make a search link with some target namespaces.

Parameters
string$termThe term to search for
string$labelLink's text
string$tooltipLink's tooltip
array$paramsQuery string parameters
Returns
string HTML fragment

Definition at line 213 of file SearchFormWidget.php.

References Xml\element().

Referenced by MediaWiki\Search\SearchWidgets\SearchFormWidget\profileTabsHtml().

◆ optionsHtml()

MediaWiki\Search\SearchWidgets\SearchFormWidget::optionsHtml (   $term,
  $isPowerSearch,
  $profile 
)
protected

Generates HTML for advanced options available with the currently selected search profile.

Parameters
string$termUser provided search term
bool$isPowerSearchIs the advanced search profile enabled?
string$profileThe current search profile
Returns
string HTML

Definition at line 238 of file SearchFormWidget.php.

References MediaWiki\Search\SearchWidgets\SearchFormWidget\getHookRunner(), and MediaWiki\Search\SearchWidgets\SearchFormWidget\powerSearchBox().

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

◆ powerSearchBox()

MediaWiki\Search\SearchWidgets\SearchFormWidget::powerSearchBox (   $term,
array  $opts 
)
protected
Parameters
string$termThe current search term
array$optsAdditional key/value pairs that will be submitted with the generated form.
Returns
string HTML

Definition at line 259 of file SearchFormWidget.php.

References Xml\checkLabel(), MediaWiki\Search\SearchWidgets\SearchFormWidget\getHookRunner(), MediaWiki\MediaWikiServices\getInstance(), and Html\hidden().

Referenced by MediaWiki\Search\SearchWidgets\SearchFormWidget\optionsHtml().

◆ profileTabsHtml()

MediaWiki\Search\SearchWidgets\SearchFormWidget::profileTabsHtml (   $profile,
  $term 
)
protected

Generates HTML for the list of available search profiles.

Parameters
string$profileThe currently selected profile
string$termThe user provided search terms
Returns
string HTML

Definition at line 162 of file SearchFormWidget.php.

References $lang, MediaWiki\Search\SearchWidgets\SearchFormWidget\makeSearchLink(), MediaWiki\Search\SearchWidgets\SearchFormWidget\startsWithImage(), and Xml\tags().

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

◆ render()

MediaWiki\Search\SearchWidgets\SearchFormWidget::render (   $profile,
  $term,
  $numResults,
  $totalResults,
  $offset,
  $isPowerSearch,
array  $options = [] 
)
Parameters
string$profileThe current search profile
string$termThe current search term
int$numResultsThe number of results shown
int$totalResultsThe total estimated results found
int$offsetCurrent offset in search results
bool$isPowerSearchIs the 'advanced' section open?
array$optionsWidget options
Returns
string HTML

Definition at line 55 of file SearchFormWidget.php.

References Xml\openElement(), MediaWiki\Search\SearchWidgets\SearchFormWidget\optionsHtml(), MediaWiki\Search\SearchWidgets\SearchFormWidget\profileTabsHtml(), MediaWiki\Search\SearchWidgets\SearchFormWidget\shortDialogHtml(), and wfScript().

◆ shortDialogHtml()

MediaWiki\Search\SearchWidgets\SearchFormWidget::shortDialogHtml (   $profile,
  $term,
  $numResults,
  $totalResults,
  $offset,
array  $options = [] 
)
protected
Parameters
string$profileThe current search profile
string$termThe current search term
int$numResultsThe number of results shown
int$totalResultsThe total estimated results found
int$offsetCurrent offset in search results
array$optionsWidget options
Returns
string HTML

Definition at line 98 of file SearchFormWidget.php.

References Html\hidden(), and Xml\tags().

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

◆ startsWithImage()

MediaWiki\Search\SearchWidgets\SearchFormWidget::startsWithImage (   $term)
protected

Check if query starts with image: prefix.

Parameters
string$termThe string to check
Returns
bool

Definition at line 196 of file SearchFormWidget.php.

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

Referenced by MediaWiki\Search\SearchWidgets\SearchFormWidget\profileTabsHtml().

Member Data Documentation

◆ $hookContainer

HookContainer MediaWiki\Search\SearchWidgets\SearchFormWidget::$hookContainer
private

◆ $hookRunner

HookRunner MediaWiki\Search\SearchWidgets\SearchFormWidget::$hookRunner
private

◆ $profiles

array MediaWiki\Search\SearchWidgets\SearchFormWidget::$profiles
protected

◆ $searchConfig

SearchEngineConfig MediaWiki\Search\SearchWidgets\SearchFormWidget::$searchConfig
protected

◆ $specialSearch

SpecialSearch MediaWiki\Search\SearchWidgets\SearchFormWidget::$specialSearch
protected

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