TypoScript configuration¶
Each Extbase extension has some settings which can be modified using TypoScript.
Many of these settings affect aspects of the internal configuration of Extbase
and Fluid. There is also a block settings
in which you can
set extension specific settings that can be accessed in the controllers and
templates of your extension.
All TypoScript settings are made in the following TypoScript blocks:
plugin.tx_[lowercasedextensionname]
The TypoScript configuration of the extension is always located below this
TypoScript path. The "lowercase extension name" is the extension key with no
underscore (_), as for example in blogexample
. The configuration is divided into
the following sections:
Features¶
Activate features for Extbase or a specific plugin.
features.skipDefaultArguments
Skip default arguments in URLs. If a link to the default controller or action is created, the parameters are omitted. Default is
false
.features.ignoreAllEnableFieldsInBe
Ignore the enable fields in backend. Default is
false
.
Persistence¶
Settings, relevant to the persistence layer of Extbase.
persistence.enableAutomaticCacheClearing
Enables the automatic cache clearing when changing data sets (see also the section extbase_caching_of_actions_and_records). Default is
true
.persistence.storagePid
List of Page-IDs, from which all records are read (see the section "Procedure to fetch objects" in Chapter 6).
Settings¶
Here reside are all the domain-specific extension settings. These settings are
available in the controllers as the array variable $this->settings
and in any Fluid
template with {settings}
.
Tip
The settings allow you to pass arbitrary information to a template, even for 3rd-party extensions. Just make sure you prefix them with a unique vendor to prevent collisions with further updates of the extensions.
View¶
View and template settings.
view.layoutRootPaths
This can be used to specify the root paths for all Fluid layouts in this extension. If nothing is specified, the path
extensionName/Resources/Private/Layouts
is used. All layouts that are necessary for this extension should reside in this folder.view.partialRootPaths
This can be used to specify the root paths for all Fluid partials in this extension. If nothing is specified, the path
extensionName/Resources/Private/Partials
is used. All partials that are necessary for this extension should reside in this folder.view.templateRootPaths
This can be used to specify the root paths for all Fluid templates in this extension. If nothing is specified, the path
extensionName/Resources/Private/Templates
is used. All templates that are necessary for this extension should reside in this folder.view.pluginNamespace
This can be used to specify an alternative namespace for the plugin. Use this to shorten the Extbase default plugin namespace or to access arguments from other extensions by setting this option to their namespace. .. todo: This is not understandable without an example. This option might be deprecated and dropped.
view.defaultPid
This can be used to specify a default target page ID. If this value is set, this value will be used as target page ID. If
defaultPid
is set toauto
, a pid is determined by loading the tt_content record that contains this plugin. An error will be thrown if more than one record matches thelist_type
.
All root paths are defined as an array which enables you to define multiple root paths that will be used by Extbase to find the desired template files.
An example best describes the feature.
Imagine you installed the extension news
, which provides several plugins for
rendering news in the frontend.
The default template directory of that extension is the following:
EXT:my_extension/Resources/Private/Templates/
.
Let's assume you want to change the plugin's output because you need to use different CSS classes, for example. You can simply create your own extension and add the following TypoScript setup:
plugin.tx_news {
view {
templateRootPaths.10 = EXT:my_extension/Resources/Private/Templates/
}
}
As all TypoScript will be merged, the following configuration will be compiled:
plugin.tx_news {
view {
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
10 = EXT:my_extension/Resources/Private/Templates/
}
...
}
}
Imagine there is a news plugin that lists news entries. In that case, the listAction
method
of the NewsController
will be called. By convention, Extbase will look for an html file
called List.html
in a folder News
in all of the configured template root paths.
If there is just one root path configured, that is the one being chosen right away. Once there
are more paths defined, Extbase will check them in reverse order, i.e., from the highest key
to lowest. Following our example, Extbase will check the given path with key 10
first, and if
no template file is found, it will proceed with 0
.
Tip
If there is no root path defined at all, a fallback path will be created during runtime. The fallback path consists of the extension key and a fixed directory path.
More information on root paths can be found in the TypoScript reference: templateRootPaths
MVC¶
These are useful MVC settings about error handling:
mvc.callDefaultActionIfActionCantBeResolved
Will cause the controller to show its default action , e.g., if the called action is not allowed by the controller.
mvc.throwPageNotFoundExceptionIfActionCantBeResolved
Same as
mvc.callDefaultActionIfActionCantBeResolved
but this will raise a "page not found" error.
_LOCAL_LANG¶
Under this key, you can modify localized strings for this extension.
If you specify, for example, plugin.tx_blogexample._LOCAL_LANG.default.read_more =
More>>
then the standard translation for the key read_more
is overwritten by the
string More>>.
Format¶
The output of Extbase plugins can be provided in different formats, e.g., HTML, CSV, JSON, …. The required format can be requested via the request parameter. The default format, if nothing is requested, can be set via TypoScript. This can be combined with conditions.
format
Defines the default format for the plugin.