MediaWiki  master
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)
 

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)
 
 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 193 of file SearchFormWidget.php.

References $params, $term, and 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 218 of file SearchFormWidget.php.

References $html, $term, 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 240 of file SearchFormWidget.php.

References $name, $rows, $term, $user, $value, as, Xml\checkLabel(), MediaWiki\MediaWikiServices\getInstance(), Html\hidden(), 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

Definition at line 142 of file SearchFormWidget.php.

References $lang, $term, as, MediaWiki\Widget\Search\SearchFormWidget\makeSearchLink(), null, 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 
)
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?
Returns
string HTML

Definition at line 45 of file SearchFormWidget.php.

References $term, $user, 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 
)
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
Returns
string HTML

Definition at line 86 of file SearchFormWidget.php.

References $html, $term, Html\hidden(), and 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 176 of file SearchFormWidget.php.

References $term, 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: