Is there a possibility to set a default value for frame_class?
I guess it could be something like this:
TCEFORM {
tt_content {
frame_class {
default = none
}
}
}
no frame is the prefered default. Any ideas?
You have to use TCAdefaults for that.
TCAdefaults.tt_content.frame_class = none
Related
The way to add a DataProcessor to a PAGE or a FLUIDTEMPLATE is often shown. How can it be assigned to a TYPO3 plugin?
For a PAGE you can do it like this:
page {
10 {
dataProcessing {
1558428437 = BK2K\BootstrapPackage\DataProcessing\ConstantsProcessor
1558428437 {
as = myconstants
key = settings.constants
}
}
}
}
But can you do something like this:
config.tx_extbase {
dataProcessing {
1558428437 = BK2K\BootstrapPackage\DataProcessing\ConstantsProcessor
1558428437 {
as = myconstants
key = settings.constants
}
}
Many thanks!
No, this is not possible since data processors is a feature of the FLUIDTEMPLATE content object alone.
In this case you can invoke the ConstantsProcessor manually in your controller action. You can get the current ContentObjectRenderer via $this->configurationManager->getContentObject(). The $processorConfiguration is the same as in TypoScript but as array:
$constantsProcessor = GeneralUtility::makeInstance(ConstantsProcessor::class);
$data = $constantsProcessor->process(
$this->configurationManager->getContentObject(),
[],
[
'key' => 'settings.constants',
'as' => 'myconstants',
],
[]
);
// Use $data['myconstants']
That's currently not possible.
This would definitely be a feature that would make live of Integrators much easier.
I was using fluidpages for template building, and would like to choose the template dynamically based on a field in the fe_users table. For example, most people will see the EXT:default template by default, while some will see EXT:advanced template instead, as they are marked as special.
I tried
plugin.tx_template {
view {
templateRootPaths {
0 = EXT:default/Resources/Private/Templates/
10 {
data = TSFE:fe_user|user|template
wrap = EXT: | /Resources/Private/Templates/
}
}
}
}
But it seems the TS is not parsed and is used directly by fluid, therefore failed.
Any idea or hint is appreciated!
Actually this may be possible. But i can't see an obvious way on how to override the chosen template in the page properties.
To my knowledge, you are required to select a template in the page record.
If you find a possibility to override that one, you could use a TS Setup like this:
EXT:template_package/Configuration/TypoScript/constants.txt:
plugin.tx_templatepackage {
view {
templateRootPaths.default = EXT:template_package/Resources/Private/Templates/
partialRootPaths.default = EXT:template_package/Resources/Private/Partials/
layoutRootPaths.default = EXT:template_package/Resources/Private/Layouts/
}
}
EXT:template_package/Configuration/TypoScript/setup.txt:
plugin.tx_templatepackage {
view {
templateRootPaths.default = {$plugin.tx_templatepackage.view.templateRootPaths.default}
partialRootPaths.default = {$plugin.tx_templatepackage.view.partialRootPaths.default}
layoutRootPaths.default = {$plugin.tx_templatepackage.view.layoutRootPaths.default}
}
}
Above part will setup your global paths.
After that, you'll define your sub packages for templates.
EXT:template_package/Configuration/TypoScript/Basic/setup.txt
plugin.tx_templatepackage {
view {
templateRootPaths.10 = {$plugin.tx_templatepackage.view.templateRootPaths.0}Basic/
partialRootPaths.10 = {$plugin.tx_templatepackage.view.partialRootPaths.0}Basic/
layoutRootPaths.10 = {$plugin.tx_templatepackage.view.layoutRootPaths.0}Basic/
}
}
And
EXT:template_package/Configuration/TypoScript/Advanced/setup.txt
plugin.tx_templatepackage {
view {
templateRootPaths.20 = {$plugin.tx_templatepackage.view.templateRootPaths.0}Advanced/
partialRootPaths.20 = {$plugin.tx_templatepackage.view.partialRootPaths.0}Advanced/
layoutRootPaths.20 = {$plugin.tx_templatepackage.view.layoutRootPaths.0}Advanced/
}
}
Of course you should make them available within TYPO3:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Template Package: Base');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Basic', 'Template Package: Basic');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Advanced', 'Template Package: Advanced');
After all of that, you could override a value — IDK which one — via:
[usergroup = group1-uid]
// override option, which defines the default template
[usergroup = group2-uid]
// override option, which defines the default template
Sorry I can't help you out any further. I tried to dig deeper into EXT:flux and EXT:fluidpages. But i can't see that option.
I am using a custom plugin and I need to add the page title as one of the plugin's settings variables:
plugin.tx_fsearch {
settings {
resultsPath = search-results/brand/{field:title}/make/{field:title}
resultsPath.insertData = 1
}
}
However this is outputting the word 'Array' instead of the path I need.
Does anyone know how I might be able to make this work?
There is no stdWrap available for settings in extbase extensions, no matter if using TEXT cObj or insertData!
As a workaround, you can fix that yourself by doing something like EXT:news does here https://github.com/georgringer/news/blob/master/Classes/Controller/NewsController.php#L495
public function injectConfigurationManager(
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
) {
$this->configurationManager = $configurationManager;
$typoScriptService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
$typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings);
$stdWrapProperties = GeneralUtility::trimExplode(',', $originalSettings['useStdWrap'], true);
foreach ($stdWrapProperties as $key) {
if (is_array($typoScriptArray[$key . '.'])) {
$originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap(
$originalSettings[$key],
$typoScriptArray[$key . '.']
);
}
}
}
$this->settings = $originalSettings;
}
Or you skip the TS part and call the stdWrap directly in your controller.
Try TEXT object
plugin.tx_fsearch {
settings {
resultsPath = TEXT
resultsPath.value = search-results/brand/{field.title}/make/{field.title}
}
}
How can I use multiple overrides based on the layout?
Single use currently works like this:
tt_content.image.20.1 {
file.width.override {
override = 200c
override.if {
equals.field = layout
value = 1
}
}
}
But I need a different width override for different layout values.
I think I need to do something like this incorrect code:
#does not work
tt_content.image.20.1.file.width = CASE
tt_content.image.20.1.file.width {
key.field = layout
1 = TEXT
1.value = 200c
2 = TEXT
2.value = 400c
}
if an attribute must be enhanced you (nearly) always can use .cObject to enhance it [1].
so you might use something like this:
tt_content.image.20.1 {
file.width.override {
override.cObject = CASE
override.cObject {
key.field = layout
1 = TEXT
1.value = 200c
2 = TEXT
2.value = 400c
}
}
}
[1] this belongs to typoscript used by the core. extensions like plugins, userfuncs may handle their typoscript on their own way not conform to core functionality like .stdWrap
I am working on some Typo3 6.2 templates. I want to insert a link into the template using Typoscript.
I have a constant {$HOME_SHORTCUT}, which has the title "Startseite" & the path /start. I want the link to look like this:
Startseite
I am using this to insert the link before a set of breadcrumbs. The link path is correct but the value/text of the link is the pageID of {$HOME_SHORTCUT}, not the header text, which is what I want:
stdWrap.prepend = TEXT
stdWrap.prepend {
value = {$HOME_SHORTCUT} ###HOW DO I USE THE TITLE OF THE PAGE AS THE VALUE?####
stdWrap.typolink {
field = header
parameter = {$HOME_SHORTCUT}
}
}
This outputs:
146
Which is incorrect. That's the page ID, not the header. How do I get the header of {$HOME_SHORTCUT}?
When you leave out the "value" the page title is set automatically:
stdWrap.prepend = TEXT
stdWrap.prepend.typolink.parameter = {$HOME_SHORTCUT}
Following along with this answer, I constructed this, which gives the desired mark-up:
stdWrap.prepend = TEXT
stdWrap.prepend {
value {
table = pages
select {
where = uid = {$HOME_SHORTCUT}
}
renderObj {
10 = TEXT
10 {
field = title
wrap = |
}
}
}
stdWrap.typolink {
field = header
parameter = {$HOME_SHORTCUT}
}
}
Which seems like a really, really long-winded way of saying "Wrap this page title with a link to this page"- I am definitely interested in hearing of better methods.