MediaWiki REL1_31
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.
 
 optionsHtml ( $term, $isPowerSearch, $profile)
 Generates HTML for advanced options available with the currently selected search profile.
 
 powerSearchBox ( $term, array $opts)
 
 profileTabsHtml ( $profile, $term)
 Generates HTML for the list of available search profiles.
 
 shortDialogHtml ( $profile, $term, $numResults, $totalResults, $offset)
 
 startsWithImage ( $term)
 Check if query starts with image: prefix.
 

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

References $params, and $term.

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

References $html, $term, and MediaWiki\Widget\Search\SearchFormWidget\powerSearchBox().

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

References $name, $rows, $term, $user, $value, $wgContLang, as, and global.

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

References $lang, $term, as, MediaWiki\Widget\Search\SearchFormWidget\makeSearchLink(), and MediaWiki\Widget\Search\SearchFormWidget\startsWithImage().

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, 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 81 of file SearchFormWidget.php.

References $html, and $term.

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

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