SearchController

class \TYPO3\CMS\IndexedSearch\Controller\SearchController

Extends
ActionController

Index search frontend

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

Table of Contents

Properties

$actionMethodName  : non-empty-string
Name of the action method
$arguments  : Arguments
$availableResultsNumbers  : array
$configurationManager  : ConfigurationManagerInterface
$defaultResultNumber  : int
$defaultViewObjectName  : class-string|null
The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.
$errorMethodName  : string
Name of the special error action method which is called in case of errors
$eventDispatcher  : EventDispatcherInterface
$externalParsers  : array
$fileHandlingService  : FileHandlingService
$firstRow  : array
Will hold the first row in result - used to calculate relative hit-ratings.
$hashService  : HashService
$mvcPropertyMappingConfigurationService  : MvcPropertyMappingConfigurationService
$pathCache  : array
$reflectionService  : ReflectionService
$request  : RequestInterface
$requiredFrontendUsergroups  : array
Required fe_groups memberships for display of a result.
$responseFactory  : ResponseFactoryInterface
$resultSections  : array
Page tree sections for search result.
$searchRootPageIdList  : string|int
This is the id of the site root.
$searchWords  : array
$settings  : array
Contains the settings of the current extension
$streamFactory  : StreamFactoryInterface
$sword  : string
$uriBuilder  : UriBuilder
$validatorResolver  : ValidatorResolver
$view  : ViewInterface|ViewInterface
The current view, as resolved by resolveView()

Methods

__construct()  : mixed
addFlashMessage()  : void
Creates a Message object and adds it to the FlashMessageQueue.
formAction()  : ResponseInterface
Handles and prepares search form options for rendering.
initializeControllerArgumentsBaseValidators()  : void
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()  : void
injectEventDispatcher()  : void
injectFileHandlingService()  : void
injectHashService()  : void
injectInternalExtensionService()  : void
injectInternalFlashMessageService()  : void
injectMvcPropertyMappingConfigurationService()  : void
injectPropertyMapper()  : void
injectReflectionService()  : void
injectResponseFactory()  : void
injectStreamFactory()  : void
injectValidatorResolver()  : void
injectViewFactory()  : void
injectViewResolver()  : void
noTypoScriptAction()  : ResponseInterface
Action displayed when TypoScript was not loaded
processRequest()  : ResponseInterface
Handles an incoming request and returns a response object
searchAction()  : ResponseInterface
Executes a search operation based on the provided criteria, displays the search results, and logs relevant statistics.
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.
addDefaultPathToPaths()  : string[]
Adds extbase's default template path to the configured list of template paths. The default path is usually used as a fallback if no paths are specified or if the template cannot be found in any of the configured paths. However, if the default path is already present in the configured paths, the specified position takes precedence. This allows the default path to be "moved" within the list of paths via configuration.
addErrorFlashMessage()  : void
If an error occurred during this request, this adds a flash message describing the error to the flash message container.
addOperatorLabel()  : array
Process the search word operator to be used in e.g. locallang keys
buildPagination()  : PaginationInterface
callActionMethod()  : ResponseInterface
Calls the specified action method and passes the arguments.
compileResultRows()  : array
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
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
get the values for the "group" selector
getAllAvailableIndexConfigurationsOptions()  : array
get the values for the "freeIndexUid" selector
getAllAvailableMediaTypesOptions()  : array
Get the values for the "media type" selector
getAllAvailableNumberOfResultsOptions()  : array
get the values for the "results" selector
getAllAvailableOperandsOptions()  : array
Get the values for the "defaultOperand" selector
getAllAvailableSearchTypeOptions()  : array
Get the values for the "type" selector
getAllAvailableSectionsOptions()  : array
Get the values for the "section" selector Here values like "rl1_" and "rl2_" + a root level 1/2 id can be added to perform searches in root level 1+2 specifically. The id-values can even be comma-separated. e.g. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uids 1 and 2.
getAllAvailableSortDescendingOptions()  : array
get the values for the "sortDescending" selector
getAllAvailableSortOrderOptions()  : array
get the values for the "section" selector Here values like "rl1_" and "rl2_" + a root level 1/2 id can be added to perform searches in root level 1+2 specifically. The id-values can even be comma-separated. e.g. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uids 1 and 2.
getDisplayResults()  : array
Compiles the HTML display of the incoming array of result rows.
getErrorFlashMessage()  : bool|string
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.
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
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
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 (e.g. AND, OR)
handleArgumentMappingExceptions()  : void
This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.
htmlResponse()  : ResponseInterface
Returns a response object with either the given html string or the current rendered view as content.
initialize()  : array
Sets up all necessary object for searching
initializeAction()  : void
Initializes the controller before invoking an action method.
initializeActionMethodArguments()  : void
Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action
initializeActionMethodValidators()  : void
Adds the needed validators to the Arguments:
initializeExternalParsers()  : void
simple function to initialize possible external parsers feeds the $this->externalParsers array
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()  : LinkResultInterface
Links the $linkText to page $pageUid
loadSettings()  : void
Load settings and apply stdWrap to them
makeDescription()  : string
Returns the resume for the search-result.
mapRequestArgumentsToControllerArguments()  : void
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
processExtendedSearchParameters()  : array
Process variables related to indexed_search extendedSearch needed by frontend view.
procSearchWordsByLexer()  : array
Post-process the search word array, so it will match the words that was indexed (including case-folding if any).
redirect()  : ResponseInterface
Redirects the request to another action and / or controller.
redirectToUri()  : ResponseInterface
Redirects the web request to another uri.
removeOptionsFromOptionList()  : array
removes blinding entries from the option list of a selector
renderAssetsForRequest()  : void
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|ViewInterface
Prepares a view for the current action.

Properties

$actionMethodName

Name of the action method

protected non-empty-string $actionMethodName = 'indexAction'

$availableResultsNumbers

protected array $availableResultsNumbers = []

$defaultResultNumber

protected int $defaultResultNumber = 10

$defaultViewObjectName

The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.

protected class-string|null $defaultViewObjectName = null

$errorMethodName

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

protected string $errorMethodName = 'errorAction'

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$externalParsers

protected array $externalParsers = []

$firstRow

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

protected array $firstRow = []

$requiredFrontendUsergroups

Required fe_groups memberships for display of a result.

protected array $requiredFrontendUsergroups = []

$responseFactory

protected ResponseFactoryInterface $responseFactory

$resultSections

Page tree sections for search result.

protected array $resultSections = []

$searchRootPageIdList

This is the id of the site root.

protected string|int $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 (e.g. -1) searching will happen in ALL of the page tree with no regard to branches at all.

$searchWords

protected array $searchWords = []

$settings

Contains the settings of the current extension

protected array $settings

$streamFactory

protected StreamFactoryInterface $streamFactory

$view

The current view, as resolved by resolveView()

protected ViewInterface|ViewInterface $view

Tags

todo

Use "protected ViewInterface $view;" in v14.

Methods

addFlashMessage()

Creates a Message object and adds it to the FlashMessageQueue.

public addFlashMessage(string $messageBody[, string $messageTitle = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = true ]) : void

Parameters

$messageBody : string
$messageTitle : string = ''
$severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
$storeInSession : bool = true

Tags

throws
InvalidArgumentException

if the message body is no string

see
FlashMessage

formAction()

Handles and prepares search form options for rendering.

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

Parameters

$search : array<string, mixed> = []

Optional search parameters, typically from form input.

Return values

ResponseInterface

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() : void

injectEventDispatcher()

public injectEventDispatcher(EventDispatcherInterface $eventDispatcher) : void

Parameters

$eventDispatcher : EventDispatcherInterface

injectResponseFactory()

public final injectResponseFactory(ResponseFactoryInterface $responseFactory) : void

Parameters

$responseFactory : ResponseFactoryInterface

injectStreamFactory()

public final injectStreamFactory(StreamFactoryInterface $streamFactory) : void

Parameters

$streamFactory : StreamFactoryInterface

noTypoScriptAction()

Action displayed when 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

Return values

ResponseInterface

searchAction()

Executes a search operation based on the provided criteria, displays the search results, and logs relevant statistics.

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

Parameters

$search : array<string, mixed> = []

The search criteria, typically data submitted from the search form.

Return values

ResponseInterface

throwStatus()

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

public throwStatus(int $statusCode[, string $statusMessage = '' ][, string|null $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 = ''

A custom HTTP status message

$content : string|null = 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

Return values

string

addDefaultPathToPaths()

Adds extbase's default template path to the configured list of template paths. The default path is usually used as a fallback if no paths are specified or if the template cannot be found in any of the configured paths. However, if the default path is already present in the configured paths, the specified position takes precedence. This allows the default path to be "moved" within the list of paths via configuration.

protected addDefaultPathToPaths(mixed $paths, string $defaultPath) : string[]

Parameters

$paths : mixed
$defaultPath : string

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() : void

addOperatorLabel()

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

protected addOperatorLabel(array $searchWord) : array

Parameters

$searchWord : array

Return values

array

buildPagination()

protected buildPagination(array<string, mixed> $searchData, array<int, array<string, mixed>> $rows, int $count) : PaginationInterface

Parameters

$searchData : array<string, mixed>

Search input and resolved search configuration

$rows : array<int, array<string, mixed>>

Search result rows for the current page

$count : int

Return values

PaginationInterface

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

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 $searchData, array $resultRows[, int $freeIndexUid = -1 ]) : array

Parameters

$searchData : array
$resultRows : array

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 —

the result rows with additional information

compileSingleResultRow()

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

protected compileSingleResultRow(array $searchData, array $row[, int $headerOnly = 0 ]) : array

Parameters

$searchData : array
$row : array

Search result row

$headerOnly : int = 0

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

Return values

array —

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.

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

Return values

ResponseInterface|null

getAllAvailableGroupOptions()

get the values for the "group" selector

protected getAllAvailableGroupOptions() : array

Return values

array —

Associative array with options

getAllAvailableIndexConfigurationsOptions()

get the values for the "freeIndexUid" selector

protected getAllAvailableIndexConfigurationsOptions() : array

Return values

array —

Associative array with options

getAllAvailableMediaTypesOptions()

Get the values for the "media type" selector

protected getAllAvailableMediaTypesOptions() : array

Return values

array —

Associative array with options

getAllAvailableNumberOfResultsOptions()

get the values for the "results" selector

protected getAllAvailableNumberOfResultsOptions() : array

Return values

array —

Associative array with options

getAllAvailableOperandsOptions()

Get the values for the "defaultOperand" selector

protected getAllAvailableOperandsOptions() : array

Return values

array —

Associative array with options

getAllAvailableSearchTypeOptions()

Get the values for the "type" selector

protected getAllAvailableSearchTypeOptions() : array

Return values

array —

Associative array with options

getAllAvailableSectionsOptions()

Get the values for the "section" selector Here values like "rl1_" and "rl2_" + a root level 1/2 id can be added to perform searches in root level 1+2 specifically. The id-values can even be comma-separated. e.g. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uids 1 and 2.

protected getAllAvailableSectionsOptions() : array

Return values

array —

Associative array with options

getAllAvailableSortDescendingOptions()

get the values for the "sortDescending" selector

protected getAllAvailableSortDescendingOptions() : array

Return values

array —

Associative array with options

getAllAvailableSortOrderOptions()

get the values for the "section" selector Here values like "rl1_" and "rl2_" + a root level 1/2 id can be added to perform searches in root level 1+2 specifically. The id-values can even be comma-separated. e.g. "rl1_1,2" would search for stuff inside pages on menu-level 1 which has the uids 1 and 2.

protected getAllAvailableSortOrderOptions() : array

Return values

array —

Associative array with options

getDisplayResults()

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

protected getDisplayResults(array $searchData, array $searchWords, array|bool $resultData[, int $freeIndexUid = -1 ]) : array

Parameters

$searchData : array
$searchWords : array

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

$resultData : array|bool

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

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() : bool|string

Returns either the flash message or "false" if no flash message should be set

Return values

bool|string

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

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.

Return values

string

getMenuOfPages()

Return the menu of pages used for the selector.

protected getMenuOfPages(int $pageUid) : array

Parameters

$pageUid : int

Page ID for which to return menu

Return values

array —

Menu items (for making the section selector box)

getNumberOfResults()

Returns number of results to display

protected getNumberOfResults(int $numberOfResults) : int

Parameters

$numberOfResults : int

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 (e.g. AND, OR)

protected getSearchWords(array $searchData, bool $useDefaultOperator) : array

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

$searchData : array
$useDefaultOperator : bool

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

Return values

array

handleArgumentMappingExceptions()

This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.

protected handleArgumentMappingExceptions(Exception $exception) : void

Extension authors can override this function to implement additional/custom argument mapping exception handling

Parameters

$exception : Exception

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

initialize()

Sets up all necessary object for searching

protected initialize([array $searchData = [] ]) : array

Parameters

$searchData : array = []

Return values

array

initializeAction()

Initializes the controller before invoking an action method.

protected initializeAction() : void

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() : void

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

Tags

throws
InvalidArgumentTypeException
see
initializeArguments()

initializeActionMethodValidators()

Adds the needed validators to the Arguments:

protected initializeActionMethodValidators() : void
  • 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

initializeExternalParsers()

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

protected initializeExternalParsers() : void

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

loadSettings()

Load settings and apply stdWrap to them

protected loadSettings() : void

makeDescription()

Returns the resume for the search-result.

protected makeDescription(array $row[, bool $noMarkup = false ][, int $length = 180 ]) : string

Parameters

$row : array
$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

Tags

todo

overwork this

Return values

string

mapRequestArgumentsToControllerArguments()

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

protected mapRequestArgumentsToControllerArguments() : void

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

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

processExtendedSearchParameters()

Process variables related to indexed_search extendedSearch needed by frontend view.

protected processExtendedSearchParameters() : array

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

Return values

array —

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).

protected procSearchWordsByLexer(array $searchWords) : array

If any words are split into multiple words (e.g. CJK will be!) the operator of the main word will remain.

Parameters

$searchWords : array

Search word array

Return values

array —

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|null $arguments = null ][, int|null $pageUid = null ][, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface

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|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

Return values

ResponseInterface

redirectToUri()

Redirects the web request to another uri.

protected redirectToUri(string|UriInterface $uri[, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface

Parameters

$uri : string|UriInterface

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"

Return values

ResponseInterface

removeOptionsFromOptionList()

removes blinding entries from the option list of a selector

protected removeOptionsFromOptionList(array $allOptions, mixed $blindOptions) : array

Parameters

$allOptions : array

associative array containing all options

$blindOptions : mixed

Either associative array containing the option key to be removed, or anything else (= not configured)

Return values

array —

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) : void

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

resolveActionMethodName()

Resolves and checks the current action method name

protected resolveActionMethodName() : string

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

resolveView()

Prepares a view for the current action.

protected resolveView() : ViewInterface|ViewInterface

Tags

todo

Set "protected function resolveView(): ViewInterface" in v14.

todo

We may want to decide in extbase to go away from the automatic view preparation via processRequest() and this method for actions. We could very well postulate actions should take care of creating "their" view on their own using a ViewFactoryInterface implementation, similar to what is done with request creation already (which needs further work, too), and have a helper in this class to easily create a standard view. This would dissolve the ugly $this->defaultViewObjectName property, which is more a burden than helpful since controllers then need to have an initializeFooAction() just to set this property when different actions want different views. Also, it does not allow actions to have no view prepared at all, for instance when they just want to create a json response by json_encode()'ing stuff. We should look at this in v14, when GenericViewResolver and ViewResolverInterface are gone, which renders property defaultViewObjectName even more useless.

Return values

ViewInterface|ViewInterface
On this page