MediaWiki  1.34.0
MediaWiki\Widget\Search\SearchFormWidget Class Reference
Collaboration diagram for MediaWiki\Widget\Search\SearchFormWidget:

Public Member Functions

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

Protected Member Functions

 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
 

Detailed Description

Definition at line 13 of file SearchFormWidget.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ makeSearchLink()

MediaWiki\Widget\Search\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 204 of file SearchFormWidget.php.

References Xml\element().

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

◆ optionsHtml()

MediaWiki\Widget\Search\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 229 of file SearchFormWidget.php.

References MediaWiki\Widget\Search\SearchFormWidget\powerSearchBox(), and Hooks\run().

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

◆ powerSearchBox()

MediaWiki\Widget\Search\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 251 of file SearchFormWidget.php.

References Xml\checkLabel(), MediaWiki\MediaWikiServices\getInstance(), and Hooks\run().

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

◆ profileTabsHtml()

MediaWiki\Widget\Search\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 PhanTypeArraySuspiciousNullable

Definition at line 153 of file SearchFormWidget.php.

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

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

◆ render()

MediaWiki\Widget\Search\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 46 of file SearchFormWidget.php.

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

◆ shortDialogHtml()

MediaWiki\Widget\Search\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 89 of file SearchFormWidget.php.

References Xml\tags().

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

◆ startsWithImage()

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

Check if query starts with image: prefix.

Parameters
string$termThe string to check
Returns
bool

Definition at line 187 of file SearchFormWidget.php.

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

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

Member Data Documentation

◆ $profiles

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

◆ $searchConfig

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

◆ $specialSearch

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

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