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

Public Member Functions

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

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Protected Member Functions

 getHookContainer ()
 
 getHookRunner ()
 
 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, array $options=[])
 
 startsWithImage ( $term)
 Check if query starts with image: prefix.
 

Protected Attributes

array $profiles
 
SearchEngineConfig $searchConfig
 
SpecialSearch $specialSearch
 

Detailed Description

Definition at line 21 of file SearchFormWidget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Search\SearchWidgets\SearchFormWidget::__construct ( ServiceOptions $options,
SpecialSearch $specialSearch,
SearchEngineConfig $searchConfig,
HookContainer $hookContainer,
ILanguageConverter $languageConverter,
NamespaceInfo $namespaceInfo,
array $profiles )
Parameters
ServiceOptions$options
SpecialSearch$specialSearch
SearchEngineConfig$searchConfig
HookContainer$hookContainer
ILanguageConverter$languageConverter
NamespaceInfo$namespaceInfo
array$profiles

Definition at line 51 of file SearchFormWidget.php.

References MediaWiki\Search\SearchWidgets\SearchFormWidget\$profiles, MediaWiki\Search\SearchWidgets\SearchFormWidget\$searchConfig, MediaWiki\Search\SearchWidgets\SearchFormWidget\$specialSearch, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ getHookContainer()

MediaWiki\Search\SearchWidgets\SearchFormWidget::getHookContainer ( )
protected
Returns
HookContainer
Since
1.35

Definition at line 310 of file SearchFormWidget.php.

◆ getHookRunner()

MediaWiki\Search\SearchWidgets\SearchFormWidget::getHookRunner ( )
protected
Returns
HookRunner
Since
1.35
Access: internal
This is for use by core only. Hook interfaces may be removed without notice.

Definition at line 320 of file SearchFormWidget.php.

Referenced by MediaWiki\Search\SearchWidgets\SearchFormWidget\optionsHtml(), and MediaWiki\Search\SearchWidgets\SearchFormWidget\powerSearchBox().

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

References $params.

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

References MediaWiki\Search\SearchWidgets\SearchFormWidget\getHookRunner().

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

References MediaWiki\Search\SearchWidgets\SearchFormWidget\makeSearchLink(), and MediaWiki\Search\SearchWidgets\SearchFormWidget\startsWithImage().

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

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

References MediaWiki\MainConfigNames\CapitalLinks.

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

References NS_FILE.

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

Member Data Documentation

◆ $profiles

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

◆ $searchConfig

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

◆ $specialSearch

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

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Search\SearchWidgets\SearchFormWidget::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const CapitalLinks
Name constant for the CapitalLinks setting, for use with Config::get()
Access: internal
For use by SpecialSearch only

Definition at line 23 of file SearchFormWidget.php.

Referenced by MediaWiki\Specials\SpecialSearch\showResults().


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