SearchController extends ActionController

Index search frontend

Creates a search form for indexed search. Indexing must be enabled for this to make sense.

Internal

This class is a specific controller implementation and is not considered part of the Public TYPO3 API.

Table of Contents

Properties

$actionMethodName  : string
Name of the action method
$arguments  : Arguments
$availableResultsNumbers  : array<string|int, int>
$configurationManager  : ConfigurationManagerInterface
$controllerContext  : ControllerContext
$defaultResultNumber  : int
$defaultViewObjectName  : string
The default view object to use if none of the resolved views can render a response for the current request.
$domainRecords  : array<string|int, mixed>
$enableMetaphoneSearch  : bool
Flag whether metaphone search should be enabled
$errorMethodName  : string
Name of the special error action method which is called in case of errors
$eventDispatcher  : EventDispatcherInterface
$externalParsers  : array<string|int, mixed>
External parser objects
$firstRow  : array<string|int, mixed>
Will hold the first row in result - used to calculate relative hit-ratings.
$hashService  : HashService
$iconFileNameCache  : array<string|int, mixed>
Storage of icons
$indexerConfig  : array<string|int, mixed>
Indexer configuration, coming from TYPO3's system configuration for EXT:indexed_search
$lexerObj  : Lexer
Lexer object
$mvcPropertyMappingConfigurationService  : MvcPropertyMappingConfigurationService
$objectManager  : ObjectManagerInterface
$pathCache  : array<string|int, mixed>
Caching of page path
$reflectionService  : ReflectionService
$request  : Request
The current request.
$requiredFrontendUsergroups  : array<string|int, mixed>
Required fe_groups memberships for display of a result.
$responseFactory  : ResponseFactoryInterface
$resultSections  : array<string|int, mixed>
Page tree sections for search result.
$searchData  : array<string|int, mixed>
$searchRepository  : IndexSearchRepository
Search repository
$searchRootPageIdList  : int|string
This is the id of the site root.
$searchWords  : array<string|int, mixed>
$settings  : array<string|int, mixed>
Contains the settings of the current extension
$signalSlotDispatcher  : Dispatcher
$streamFactory  : StreamFactoryInterface
$sword  : string
previously known as $this->piVars['sword']
$typoScriptService  : TypoScriptService
$uriBuilder  : UriBuilder
$validatorResolver  : ValidatorResolver
$view  : ViewInterface
The current view, as resolved by resolveView()

Methods

addFlashMessage()  : mixed
Creates a Message object and adds it to the FlashMessageQueue.
formAction()  : ResponseInterface
Sort options about the search form
forward()  : never
Forwards the request to another action and / or controller.
getControllerContext()  : ControllerContext
getSword()  : string
Returns the search word
initialize()  : array<string|int, mixed>
sets up all necessary object for searching
initializeControllerArgumentsBaseValidators()  : mixed
Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.
injectConfigurationManager()  : mixed
injectEventDispatcher()  : void
injectHashService()  : mixed
injectInternalExtensionService()  : void
injectInternalFlashMessageService()  : void
injectMvcPropertyMappingConfigurationService()  : mixed
injectObjectManager()  : mixed
Injects the object manager
injectPropertyMapper()  : void
injectReflectionService()  : mixed
injectResponseFactory()  : mixed
injectSignalSlotDispatcher()  : mixed
injectStreamFactory()  : mixed
injectTypoScriptService()  : mixed
injectValidatorResolver()  : mixed
injectViewResolver()  : mixed
makeItemTypeIcon()  : string
Return icon for file extension
noTypoScriptAction()  : ResponseInterface
TypoScript was not loaded
processRequest()  : ResponseInterface
Handles an incoming request and returns a response object
searchAction()  : ResponseInterface
Performs the search, the display and writing stats
setSword()  : mixed
Set the search word
throwStatus()  : never
Sends the specified HTTP status immediately and only stops to run back through the middleware stack.
addBaseUriIfNecessary()  : string
Adds the base uri if not already in place.
addErrorFlashMessage()  : mixed
If an error occurred during this request, this adds a flash message describing the error to the flash message container.
addOperatorLabel()  : array<string|int, mixed>
Process the search word operator to be used in e.g. locallang keys
buildControllerContext()  : ControllerContext
Initialize the controller context
callActionMethod()  : ResponseInterface
Calls the specified action method and passes the arguments.
compileResultRows()  : array<string|int, mixed>
Takes the array with resultrows as input and returns the result-HTML-code Takes the "group" var into account: Makes a "section" or "flat" display.
compileSingleResultRow()  : array<string|int, mixed>
This prints a single result row, including a recursive call for subrows.
errorAction()  : ResponseInterface
A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.
forwardToReferringRequest()  : ResponseInterface|null
If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!
getAllAvailableGroupOptions()  : array<string|int, mixed>
get the values for the "group" selector
getAllAvailableIndexConfigurationsOptions()  : array<string|int, mixed>
get the values for the "freeIndexUid" selector
getAllAvailableLanguageOptions()  : array<string|int, mixed>
get the values for the "language" selector
getAllAvailableMediaTypesOptions()  : array<string|int, mixed>
get the values for the "media type" selector
getAllAvailableNumberOfResultsOptions()  : array<string|int, mixed>
get the values for the "results" selector
getAllAvailableOperandsOptions()  : array<string|int, mixed>
get the values for the "defaultOperand" selector
getAllAvailableSearchTypeOptions()  : array<string|int, mixed>
get the values for the "type" selector
getAllAvailableSectionsOptions()  : array<string|int, mixed>
get the values for the "section" selector Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added to perform searches in rootlevel 1+2 specifically. The id-values can even be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uid's 1 and 2.
getAllAvailableSortDescendingOptions()  : array<string|int, mixed>
get the values for the "sortDescending" selector
getAllAvailableSortOrderOptions()  : array<string|int, mixed>
get the values for the "section" selector Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added to perform searches in rootlevel 1+2 specifically. The id-values can even be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uid's 1 and 2.
getDisplayResults()  : array<string|int, mixed>
Compiles the HTML display of the incoming array of result rows.
getErrorFlashMessage()  : string|bool
A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.
getFirstDomainForPage()  : string
Gets the first domain for the page
getFlashMessageQueue()  : FlashMessageQueue
todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.
getFlattenedValidationErrorMessage()  : string
Returns a string with a basic error message about validation failure.
getMenuOfPages()  : array<string|int, mixed>
Return the menu of pages used for the selector.
getNumberOfResults()  : int
Returns number of results to display
getPathFromPageId()  : string
Returns the path to the page $id
getSearchWords()  : array<string|int, mixed>
Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holding the SQL operator (eg. AND, OR)
getSpecialConfigurationForResultRow()  : array<string|int, mixed>
Returns configuration from TypoScript for result row based on ID / location in page tree!
getViewProperty()  : array<string|int, mixed>
Handles the path resolving for *rootPath(s)
hookRequest()  : object|null
Returns an object reference to the hook object if any
htmlResponse()  : ResponseInterface
Returns a response object with either the given html string or the current rendered view as content.
initializeAction()  : mixed
Initializes the controller before invoking an action method.
initializeActionMethodArguments()  : mixed
Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action
initializeActionMethodValidators()  : mixed
Adds the needed validators to the Arguments:
initializeExternalParsers()  : mixed
simple function to initialize possible external parsers feeds the $this->externalParsers array
initializeView()  : mixed
Initializes the view before invoking an action method.
jsonResponse()  : ResponseInterface
Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.
linkPage()  : array<string|int, mixed>
Links the $linkText to page $pageUid
linkPageATagWrap()  : string
Create a tag for "path" key in search result
loadSettings()  : mixed
Load settings and apply stdWrap to them
makeDescription()  : string
Returns the resume for the search-result.
makeLanguageIndication()  : string
Returns the HTML code for language indication.
makeRating()  : string
Return the rating-HTML code for the result row. This makes use of the $this->firstRow
mapRequestArgumentsToControllerArguments()  : mixed
Maps arguments delivered by the request object to the local controller arguments.
markupSWpartsOfString()  : string
Marks up the search words from $this->searchWords in the $str with a color.
multiplePagesType()  : bool
Returns if an item type is a multipage item type
preparePageLink()  : array<string|int, mixed>
Internal method to build the page uri and link target.
processExtendedSearchParameters()  : array<string|int, mixed>
Process variables related to indexed_search extendedSearch needed by frontend view.
procSearchWordsByLexer()  : array<string|int, mixed>
Post-process the search word array so it will match the words that was indexed (including case-folding if any) If any words are splitted into multiple words (eg. CJK will be!) the operator of the main word will remain.
redirect()  : never
Redirects the request to another action and / or controller.
redirectToUri()  : never
Redirects the web request to another uri.
removeOptionsFromOptionList()  : array<string|int, mixed>
removes blinding entries from the option list of a selector
renderAssetsForRequest()  : mixed
Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.
resolveActionMethodName()  : string
Resolves and checks the current action method name
resolveView()  : ViewInterface
Prepares a view for the current action.
setViewConfiguration()  : mixed
writeSearchStat()  : void
Write statistics information to database for the search operation if there was at least one search word.

Properties

$actionMethodName

Name of the action method

protected string $actionMethodName = 'indexAction'
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$availableResultsNumbers

protected array<string|int, int> $availableResultsNumbers = []

$controllerContext

Deprecated

since v11, will be removed with v12.

protected ControllerContext $controllerContext
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$defaultResultNumber

protected int $defaultResultNumber = 10

$defaultViewObjectName

The default view object to use if none of the resolved views can render a response for the current request.

protected string $defaultViewObjectName = \TYPO3\CMS\Fluid\View\TemplateView::class

$domainRecords

protected array<string|int, mixed> $domainRecords = []
Tags
todo

remove sys_domain records

$enableMetaphoneSearch

Flag whether metaphone search should be enabled

protected bool $enableMetaphoneSearch = false

$errorMethodName

Name of the special error action method which is called in case of errors

protected string $errorMethodName = 'errorAction'

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$externalParsers

External parser objects

protected array<string|int, mixed> $externalParsers = []

$firstRow

Will hold the first row in result - used to calculate relative hit-ratings.

protected array<string|int, mixed> $firstRow = []

$hashService

protected HashService $hashService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$iconFileNameCache

Storage of icons

protected array<string|int, mixed> $iconFileNameCache = []

$indexerConfig

Indexer configuration, coming from TYPO3's system configuration for EXT:indexed_search

protected array<string|int, mixed> $indexerConfig = []

$objectManager

Deprecated

since v11, will be removed in v12

protected ObjectManagerInterface $objectManager
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$pathCache

Caching of page path

protected array<string|int, mixed> $pathCache = []

$reflectionService

protected ReflectionService $reflectionService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$request

The current request.

protected Request $request
Tags
todo

v12: Change @var to RequestInterface, when RequestInterface extends ServerRequestInterface

$requiredFrontendUsergroups

Required fe_groups memberships for display of a result.

protected array<string|int, mixed> $requiredFrontendUsergroups = []

$responseFactory

protected ResponseFactoryInterface $responseFactory

$resultSections

Page tree sections for search result.

protected array<string|int, mixed> $resultSections = []

$searchData

protected array<string|int, mixed> $searchData

$searchRootPageIdList

This is the id of the site root.

protected int|string $searchRootPageIdList = 0

This value may be a comma separated list of integer (prepared for this) Root-page PIDs to search in (rl0 field where clause, see initialize() function)

If this value is set to less than zero (eg. -1) searching will happen in ALL of the page tree with no regard to branches at all.

$searchWords

protected array<string|int, mixed> $searchWords = []

$settings

Contains the settings of the current extension

protected array<string|int, mixed> $settings

$signalSlotDispatcher

protected Dispatcher $signalSlotDispatcher
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$streamFactory

protected StreamFactoryInterface $streamFactory

$sword

previously known as $this->piVars['sword']

protected string $sword = ''

$validatorResolver

protected ValidatorResolver $validatorResolver
Internal

only to be used within Extbase, not part of TYPO3 Core API.

$view

The current view, as resolved by resolveView()

protected ViewInterface $view
Tags
todo

v12: Change signature to TYPO3Fluid\Fluid\View\ViewInterface when extbase ViewInterface is dropped.

Methods

addFlashMessage()

Creates a Message object and adds it to the FlashMessageQueue.

public addFlashMessage(string $messageBody[, string $messageTitle = '' ][, int $severity = AbstractMessage::OK ][, bool $storeInSession = true ]) : mixed
Parameters
$messageBody : string

The message

$messageTitle : string = ''

Optional message title

$severity : int = AbstractMessage::OK

Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants

$storeInSession : bool = true

Optional, defines whether the message should be stored in the session (default) or not

Tags
throws
InvalidArgumentException

if the message body is no string

see
FlashMessage

formAction()

Sort options about the search form

public formAction([array<string|int, mixed> $search = [] ]) : ResponseInterface
Parameters
$search : array<string|int, mixed> = []

The search data / params

Tags
Extbase\IgnoreValidation

("search")

Return values
ResponseInterface

forward()

Forwards the request to another action and / or controller.

public forward(string|null $actionName[, string|null $controllerName = null ][, string|null $extensionName = null ][, array<string|int, mixed>|null $arguments = null ]) : never
Deprecated

since TYPO3 11.0, will be removed in 12.0

Request is directly transferred to the other action / controller without the need for a new request.

Parameters
$actionName : string|null

Name of the action to forward to

$controllerName : string|null = null

Unqualified object name of the controller to forward to. If not specified, the current controller is used.

$extensionName : string|null = null

Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.

$arguments : array<string|int, mixed>|null = null

Arguments to pass to the target action

Tags
throws
StopActionException
see
redirect()
Return values
never

getSword()

Returns the search word

public getSword() : string
Return values
string

initialize()

sets up all necessary object for searching

public initialize([array<string|int, mixed> $searchData = [] ]) : array<string|int, mixed>
Parameters
$searchData : array<string|int, mixed> = []

The incoming search parameters

Return values
array<string|int, mixed>

Search parameters

initializeControllerArgumentsBaseValidators()

Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.

public initializeControllerArgumentsBaseValidators() : mixed
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectEventDispatcher()

public injectEventDispatcher(EventDispatcherInterface $eventDispatcher) : void
Parameters
$eventDispatcher : EventDispatcherInterface

injectHashService()

public injectHashService(HashService $hashService) : mixed
Parameters
$hashService : HashService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectInternalExtensionService()

public final injectInternalExtensionService(ExtensionService $extensionService) : void
Parameters
$extensionService : ExtensionService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectInternalFlashMessageService()

public final injectInternalFlashMessageService(FlashMessageService $flashMessageService) : void
Parameters
$flashMessageService : FlashMessageService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectObjectManager()

Injects the object manager

public injectObjectManager(ObjectManagerInterface $objectManager) : mixed
Deprecated

since v11, will be removed in v12

Parameters
$objectManager : ObjectManagerInterface
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectPropertyMapper()

public injectPropertyMapper(PropertyMapper $propertyMapper) : void
Parameters
$propertyMapper : PropertyMapper
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectReflectionService()

public injectReflectionService(ReflectionService $reflectionService) : mixed
Parameters
$reflectionService : ReflectionService
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectResponseFactory()

public final injectResponseFactory(ResponseFactoryInterface $responseFactory) : mixed
Parameters
$responseFactory : ResponseFactoryInterface

injectSignalSlotDispatcher()

public injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher) : mixed
Deprecated

since v11, will be removed in v12

Parameters
$signalSlotDispatcher : Dispatcher
Internal

only to be used within Extbase, not part of TYPO3 Core API.

injectStreamFactory()

public final injectStreamFactory(StreamFactoryInterface $streamFactory) : mixed
Parameters
$streamFactory : StreamFactoryInterface

injectValidatorResolver()

public injectValidatorResolver(ValidatorResolver $validatorResolver) : mixed
Parameters
$validatorResolver : ValidatorResolver
Internal

only to be used within Extbase, not part of TYPO3 Core API.

makeItemTypeIcon()

Return icon for file extension

public makeItemTypeIcon(string $imageType, string $alt, array<string|int, mixed> $specRowConf) : string
Parameters
$imageType : string

File extension / item type

$alt : string

Title attribute value in icon.

$specRowConf : array<string|int, mixed>

TypoScript configuration specifically for search result.

Return values
string

HTML tag for icon

noTypoScriptAction()

TypoScript was not loaded

public noTypoScriptAction() : ResponseInterface
Return values
ResponseInterface

processRequest()

Handles an incoming request and returns a response object

public processRequest(RequestInterface $request) : ResponseInterface
Parameters
$request : RequestInterface

The request object

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
ResponseInterface

searchAction()

Performs the search, the display and writing stats

public searchAction([array<string|int, mixed> $search = [] ]) : ResponseInterface
Parameters
$search : array<string|int, mixed> = []

the search parameters, an associative array

Tags
Extbase\IgnoreValidation

("search")

Return values
ResponseInterface

setSword()

Set the search word

public setSword(string $sword) : mixed
Parameters
$sword : string

throwStatus()

Sends the specified HTTP status immediately and only stops to run back through the middleware stack.

public throwStatus(int $statusCode[, string $statusMessage = null ][, string $content = null ]) : never

Note: If any other plugin or content or hook is used within a frontend request, this is skipped by design.

Parameters
$statusCode : int

The HTTP status code

$statusMessage : string = null

A custom HTTP status message

$content : string = null

Body content which further explains the status

Tags
throws
PropagateResponseException
Return values
never

addBaseUriIfNecessary()

Adds the base uri if not already in place.

protected addBaseUriIfNecessary(string $uri) : string
Parameters
$uri : string

The URI

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string

addErrorFlashMessage()

If an error occurred during this request, this adds a flash message describing the error to the flash message container.

protected addErrorFlashMessage() : mixed
Internal

only to be used within Extbase, not part of TYPO3 Core API.

addOperatorLabel()

Process the search word operator to be used in e.g. locallang keys

protected addOperatorLabel(array<string|int, mixed> $searchWord) : array<string|int, mixed>
Parameters
$searchWord : array<string|int, mixed>
Return values
array<string|int, mixed>

buildControllerContext()

Initialize the controller context

protected buildControllerContext() : ControllerContext
Deprecated

since v11, will be removed with v12.

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
ControllerContext

ControllerContext to be passed to the view

callActionMethod()

Calls the specified action method and passes the arguments.

protected callActionMethod(RequestInterface $request) : ResponseInterface

If the action returns a string, it is appended to the content in the response object. If the action doesn't return anything and a valid view exists, the view is rendered automatically.

Parameters
$request : RequestInterface
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
ResponseInterface

compileResultRows()

Takes the array with resultrows as input and returns the result-HTML-code Takes the "group" var into account: Makes a "section" or "flat" display.

protected compileResultRows(array<string|int, mixed> $resultRows[, int $freeIndexUid = -1 ]) : array<string|int, mixed>
Parameters
$resultRows : array<string|int, mixed>

Result rows

$freeIndexUid : int = -1

Pointing to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
array<string|int, mixed>

the result rows with additional information

compileSingleResultRow()

This prints a single result row, including a recursive call for subrows.

protected compileSingleResultRow(array<string|int, mixed> $row[, int $headerOnly = 0 ]) : array<string|int, mixed>
Parameters
$row : array<string|int, mixed>

Search result row

$headerOnly : int = 0

1=Display only header (for sub-rows!), 2=nothing at all

Return values
array<string|int, mixed>

the result row with additional information

errorAction()

A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.

protected errorAction() : ResponseInterface

The default implementation sets a flash message, request errors and forwards back to the originating action. This is suitable for most actions dealing with form input.

We clear the page cache by default on an error as well, as we need to make sure the data is re-evaluated when the user changes something.

Return values
ResponseInterface

forwardToReferringRequest()

If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!

protected forwardToReferringRequest() : ResponseInterface|null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
ResponseInterface|null

getAllAvailableGroupOptions()

get the values for the "group" selector

protected getAllAvailableGroupOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableIndexConfigurationsOptions()

get the values for the "freeIndexUid" selector

protected getAllAvailableIndexConfigurationsOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableLanguageOptions()

get the values for the "language" selector

protected getAllAvailableLanguageOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableMediaTypesOptions()

get the values for the "media type" selector

protected getAllAvailableMediaTypesOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableNumberOfResultsOptions()

get the values for the "results" selector

protected getAllAvailableNumberOfResultsOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableOperandsOptions()

get the values for the "defaultOperand" selector

protected getAllAvailableOperandsOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableSearchTypeOptions()

get the values for the "type" selector

protected getAllAvailableSearchTypeOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableSectionsOptions()

get the values for the "section" selector Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added to perform searches in rootlevel 1+2 specifically. The id-values can even be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uid's 1 and 2.

protected getAllAvailableSectionsOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableSortDescendingOptions()

get the values for the "sortDescending" selector

protected getAllAvailableSortDescendingOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getAllAvailableSortOrderOptions()

get the values for the "section" selector Here values like "rl1_" and "rl2_" + a rootlevel 1/2 id can be added to perform searches in rootlevel 1+2 specifically. The id-values can even be commaseparated. Eg. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uid's 1 and 2.

protected getAllAvailableSortOrderOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array with options

getDisplayResults()

Compiles the HTML display of the incoming array of result rows.

protected getDisplayResults(array<string|int, mixed> $searchWords, array<string|int, mixed> $resultData[, int $freeIndexUid = -1 ]) : array<string|int, mixed>
Parameters
$searchWords : array<string|int, mixed>

Search words array (for display of text describing what was searched for)

$resultData : array<string|int, mixed>

Array with result rows, count, first row.

$freeIndexUid : int = -1

Pointing to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content.

Return values
array<string|int, mixed>

getErrorFlashMessage()

A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.

protected getErrorFlashMessage() : string|bool
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string|bool

The flash message or FALSE if no flash message should be set

getFirstDomainForPage()

Gets the first domain for the page

protected getFirstDomainForPage(int $id) : string
Parameters
$id : int

Page id

Return values
string

Domain name

getFlashMessageQueue()

todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.

protected getFlashMessageQueue([string|null $identifier = null ]) : FlashMessageQueue
Parameters
$identifier : string|null = null
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
FlashMessageQueue

getFlattenedValidationErrorMessage()

Returns a string with a basic error message about validation failure.

protected getFlattenedValidationErrorMessage() : string

We may add all validation error messages to a log file in the future, but for security reasons (@see #54074) we do not return these here.

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
string

getMenuOfPages()

Return the menu of pages used for the selector.

protected getMenuOfPages(int $pageUid) : array<string|int, mixed>
Parameters
$pageUid : int

Page ID for which to return menu

Return values
array<string|int, mixed>

Menu items (for making the section selector box)

getNumberOfResults()

Returns number of results to display

protected getNumberOfResults(int $numberOfResults) : int
Parameters
$numberOfResults : int

Requested number of results

Return values
int

getPathFromPageId()

Returns the path to the page $id

protected getPathFromPageId(int $id[, string $pathMP = '' ]) : string
Parameters
$id : int

Page ID

$pathMP : string = ''

Content of the MP (mount point) variable

Return values
string

Path (HTML-escaped)

getSearchWords()

Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holding the SQL operator (eg. AND, OR)

protected getSearchWords(bool $defaultOperator) : array<string|int, mixed>

Only words with 2 or more characters are accepted Max 200 chars total Space is used to split words, "" can be used search for a whole string AND, OR and NOT are prefix words, overruling the default operator +/|/- equals AND, OR and NOT as operators. All search words are converted to lowercase.

$defOp is the default operator. 1=OR, 0=AND

Parameters
$defaultOperator : bool

If TRUE, the default operator will be OR, not AND

Return values
array<string|int, mixed>

Search words if any found

getSpecialConfigurationForResultRow()

Returns configuration from TypoScript for result row based on ID / location in page tree!

protected getSpecialConfigurationForResultRow(array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$row : array<string|int, mixed>

Result row

Return values
array<string|int, mixed>

Configuration array

getViewProperty()

Handles the path resolving for *rootPath(s)

protected getViewProperty(array<string|int, mixed> $extbaseFrameworkConfiguration, string $setting) : array<string|int, mixed>

numerical arrays get ordered by key ascending

Parameters
$extbaseFrameworkConfiguration : array<string|int, mixed>
$setting : string

parameter name from TypoScript

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Return values
array<string|int, mixed>

hookRequest()

Returns an object reference to the hook object if any

protected hookRequest(string $functionName) : object|null
Parameters
$functionName : string

Name of the function you want to call / hook key

Return values
object|null

Hook object, if any. Otherwise NULL.

htmlResponse()

Returns a response object with either the given html string or the current rendered view as content.

protected htmlResponse([string|null $html = null ]) : ResponseInterface
Parameters
$html : string|null = null
Return values
ResponseInterface

initializeAction()

Initializes the controller before invoking an action method.

protected initializeAction() : mixed

Override this method to solve tasks which all actions have in common.

initializeActionMethodArguments()

Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action

protected initializeActionMethodArguments() : mixed

Don't override this method - use initializeAction() instead.

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
throws
InvalidArgumentTypeException
see
initializeArguments()

initializeActionMethodValidators()

Adds the needed validators to the Arguments:

protected initializeActionMethodValidators() : mixed
  • Validators checking the data type from the @param annotation
  • Custom validators specified with validate annotations.
  • Model-based validators (validate annotations in the model)
  • Custom model validator classes
Internal

only to be used within Extbase, not part of TYPO3 Core API.

initializeExternalParsers()

simple function to initialize possible external parsers feeds the $this->externalParsers array

protected initializeExternalParsers() : mixed

initializeView()

Initializes the view before invoking an action method.

protected initializeView(ViewInterface $view) : mixed
Deprecated

since v11, will be removed in v12: Drop method along with extbase ViewInterface.

Override this method to solve assign variables common for all actions or prepare the view in another way before the action is called.

Parameters
$view : ViewInterface

The view to be initialized

jsonResponse()

Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.

protected jsonResponse([string|null $json = null ]) : ResponseInterface
Parameters
$json : string|null = null
Return values
ResponseInterface

linkPage()

Links the $linkText to page $pageUid

protected linkPage(int $pageUid[, array<string|int, mixed> $row = [] ][, array<string|int, mixed> $markUpSwParams = [] ]) : array<string|int, mixed>
Parameters
$pageUid : int

Page id

$row : array<string|int, mixed> = []

Result row

$markUpSwParams : array<string|int, mixed> = []

Additional parameters for marking up search words

Return values
array<string|int, mixed>

linkPageATagWrap()

Create a tag for "path" key in search result

protected linkPageATagWrap(string $linkText, array<string|int, mixed> $linkData) : string
Parameters
$linkText : string

Link text (nodeValue) (should be hsc'ed already)

$linkData : array<string|int, mixed>
Return values
string

HTML <A> tag wrapped title string.

loadSettings()

Load settings and apply stdWrap to them

protected loadSettings() : mixed

makeDescription()

Returns the resume for the search-result.

protected makeDescription(array<string|int, mixed> $row[, bool $noMarkup = false ][, int $length = 180 ]) : string
Parameters
$row : array<string|int, mixed>

Search result row

$noMarkup : bool = false

If noMarkup is FALSE, then the index_fulltext table is used to select the content of the page, split it with regex to display the search words in the text.

$length : int = 180

String length

Tags
todo

overwork this

Return values
string

HTML string

makeLanguageIndication()

Returns the HTML code for language indication.

protected makeLanguageIndication(array<string|int, mixed> $row) : string
Parameters
$row : array<string|int, mixed>

Result row

Return values
string

HTML code for result row.

makeRating()

Return the rating-HTML code for the result row. This makes use of the $this->firstRow

protected makeRating(array<string|int, mixed> $row) : string
Parameters
$row : array<string|int, mixed>

Result row array

Tags
todo

can this be a ViewHelper?

Return values
string

String showing ranking value

mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

protected mapRequestArgumentsToControllerArguments() : mixed
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
throws
RequiredArgumentMissingException

markupSWpartsOfString()

Marks up the search words from $this->searchWords in the $str with a color.

protected markupSWpartsOfString(string $str) : string
Parameters
$str : string

Text in which to find and mark up search words. This text is assumed to be UTF-8 like the search words internally is.

Return values
string

Processed content

multiplePagesType()

Returns if an item type is a multipage item type

protected multiplePagesType(string $item_type) : bool
Parameters
$item_type : string

Item type

Return values
bool

TRUE if multipage capable

Internal method to build the page uri and link target.

protected preparePageLink(int $pageUid, array<string|int, mixed> $row, array<string|int, mixed> $urlParameters) : array<string|int, mixed>
Parameters
$pageUid : int
$row : array<string|int, mixed>
$urlParameters : array<string|int, mixed>
Tags
todo

make use of the UriBuilder

Return values
array<string|int, mixed>

processExtendedSearchParameters()

Process variables related to indexed_search extendedSearch needed by frontend view.

protected processExtendedSearchParameters() : array<string|int, mixed>

Populate select boxes and setting some flags. The returned data can be passed directly into the view by assignMultiple()

Return values
array<string|int, mixed>

Variables to pass into the view so they can be used in fluid template

procSearchWordsByLexer()

Post-process the search word array so it will match the words that was indexed (including case-folding if any) If any words are splitted into multiple words (eg. CJK will be!) the operator of the main word will remain.

protected procSearchWordsByLexer(array<string|int, mixed> $searchWords) : array<string|int, mixed>
Parameters
$searchWords : array<string|int, mixed>

Search word array

Return values
array<string|int, mixed>

Search word array, processed through lexer

redirect()

Redirects the request to another action and / or controller.

protected redirect(string|null $actionName[, string|null $controllerName = null ][, string|null $extensionName = null ][, array<string|int, mixed>|null $arguments = null ][, int|null $pageUid = null ][, null $_ = null ][, int $statusCode = 303 ]) : never

Redirect will be sent to the client which then performs another request to the new URI.

Parameters
$actionName : string|null

Name of the action to forward to

$controllerName : string|null = null

Unqualified object name of the controller to forward to. If not specified, the current controller is used.

$extensionName : string|null = null

Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.

$arguments : array<string|int, mixed>|null = null

Arguments to pass to the target action

$pageUid : int|null = null

Target page uid. If NULL, the current page uid is used

$_ : null = null

(optional) Unused

$statusCode : int = 303

(optional) The HTTP status code for the redirect. Default is "303 See Other

Tags
throws
StopActionException

deprecated since TYPO3 11.0, method will RETURN a Core\Http\RedirectResponse instead of throwing in v12

todo:

': ResponseInterface' (without ?) in v12 as method return type together with redirectToUri() cleanup

Return values
never

redirectToUri()

Redirects the web request to another uri.

protected redirectToUri(mixed $uri[, null $_ = null ][, int $statusCode = 303 ]) : never
Parameters
$uri : mixed

A string representation of a URI

$_ : null = null

(optional) Unused

$statusCode : int = 303

(optional) The HTTP status code for the redirect. Default is "303 See Other"

Tags
throws
StopActionException

deprecated since TYPO3 11.0, will be removed in 12.0

todo:

': ResponseInterface' (without ?) in v12 as method return type together with redirectToUri() cleanup

Return values
never

removeOptionsFromOptionList()

removes blinding entries from the option list of a selector

protected removeOptionsFromOptionList(array<string|int, mixed> $allOptions, array<string|int, mixed> $blindOptions) : array<string|int, mixed>
Parameters
$allOptions : array<string|int, mixed>

associative array containing all options

$blindOptions : array<string|int, mixed>

associative array containing the optionkey as they key and the value = 1 if it should be removed

Return values
array<string|int, mixed>

Options from $allOptions with some options removed

renderAssetsForRequest()

Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.

protected renderAssetsForRequest(RequestInterface $request) : mixed

This default implementation will attempt to render the sections "HeaderAssets" and "FooterAssets" from the template that is being rendered, inserting the rendered content into either page header or footer, as appropriate. Both sections are optional and can be used one or both in combination.

You can add assets with this method without worrying about duplicates, if for example you do this in a plugin that gets used multiple time on a page.

Parameters
$request : RequestInterface
Internal

only to be used within Extbase, not part of TYPO3 Core API.

resolveActionMethodName()

Resolves and checks the current action method name

protected resolveActionMethodName() : string
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
throws
NoSuchActionException

if the action specified in the request object does not exist (and if there's no default action either).

Return values
string

Method name of the current action

resolveView()

Prepares a view for the current action.

protected resolveView() : ViewInterface

By default, this method tries to locate a view with a name matching the current action.

Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
todo

v12: Change signature to TYPO3Fluid\Fluid\View\ViewInterface when extbase ViewInterface is dropped.

Return values
ViewInterface

setViewConfiguration()

protected setViewConfiguration(ViewInterface $view) : mixed
Parameters
$view : ViewInterface
Internal

only to be used within Extbase, not part of TYPO3 Core API.

Tags
todo

v12: Change signature to TYPO3Fluid\Fluid\View\ViewInterface when extbase ViewInterface is dropped.

writeSearchStat()

Write statistics information to database for the search operation if there was at least one search word.

protected writeSearchStat(array<string|int, mixed> $searchWords) : void
Parameters
$searchWords : array<string|int, mixed>

Search Word array


        
On this page

Search results