typo3 extend backend module templateRootPaths - typo3

I want to extend the redirects-Modul within my extension, especially the template path, but it's not working:
module.tx_redirects {
view {
templateRootPaths {
0 =
1 =
200 = EXT:extkey/Resources/Private/Extensions/Redirects/Templates/
}
}
}

This is not possible. you would need to XCLASS \TYPO3\CMS\Redirects\Controller\ManagementController::initializeView

Related

TYPO3 How to overwrite blog extension in custom extension

I tried this, in my extension's setup.typoscript. but is not work for me.
plugin.tx_blog {
view {
layoutRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
}
all the "RootPaths" are arrays so change it to somting like this
plugin.tx_blog {
view {
layoutRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
the "200" in the examle is the position if Fluid is looking for a Resource (like a template) it will check every provided path in numerical order.
use the Typoscript Object Browser (in the Template Module) to check the configured RootPaths
The standard setup of that extension is a bit uncommon.
The easiest was to override the paths for fluid files is to use the constant editor. There you have fields where you can enter your own paths.
If you want to do it in the setup, you can look in the TypoScript setup of the extension that looks like shown below.
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateName = BlogList
templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
So in a short block the the paths would look like this:
page.10.templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
page.10.partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
page.10.layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
In the lines starting with 1 you can enter your own path if you never want to use the constants. For this you never have to enter it in the original TypoScript template, but just copy the block above in your own TypoScript and adjust the paths. If your TypoScript is loaded after that of the blog, it's overwriting the original values.
Take care that there exist different setups, one in each folder inside https://github.com/TYPO3GmbH/blog/tree/master/Configuration/TypoScript. So depending on the template you chose the setup must be different. But I hope you're able to adapt the way to go now.

InvalidTemplateResourceException after move to new server

i have a site package extension for my template in Typo3 9.5. Furthermore I have another extension for a specific purpose. Now this extension searches in the ProviderExtension for template files!?!? On my development machine everything works fine. After I have transferred everything to a remote server, this exception occurs on those pages where the plugin of the extension is included. Other pages work.
The Fluid template files enter code here
"/home/.sites/822/site4946398/web/bttemplate/public/typo3conf/ext/amtstafel/Resources/Private/Partials/Navigation/Top.html",
"/home/.sites/822/site4946398/web/bttemplate/public/typo3conf/ext/amtstafel/Resources/Private/Partials/Navigation/Top"
could not be loaded.
Here is the typoscript fom the Site-Template
page = PAGE
page {
config.index_enable = 1
typeNum = 0
shortcutIcon = EXT:btbuerger2/Resources/Public/Icons/favicon.ico
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName {
cObject = TEXT
cObject {
data = pagelayout
required = 1
case = uppercamelcase
split {
token = pagets__
cObjNum = 1
1.current = 1
}
}
ifEmpty = Default
}
templateRootPaths {
0 = EXT:btbuerger2/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:btbuerger2/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:btbuerger2/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
The extension amtstafel has a static typoscript which is included in the Main-Template. Here templateRootPaths and layoutRootPaths is defined. As mentioned, the Extension was built with Extension-Builder and works fine so long..
plugin.tx_amtstafel_bulletinentry {
view {
templateRootPaths.0 = EXT:{extension.shortExtensionKey}/Resources/Private/Templates/
templateRootPaths.1 = {$plugin.tx_amtstafel_bulletinentry.view.templateRootPath}
layoutRootPaths.0 = EXT:tx_amtstafel/Resources/Private/Layouts/
layoutRootPaths.1 = {$plugin.tx_amtstafel_bulletinentry.view.layoutRootPath}
}
"bttemplate" is the template extension, "amtstafel" is the additional extension.
In the place of .../amtstafe/... there is not need for partials ...
Thank you for help!
Thomas
I suspect that your constant page.fluidtemplate.partialRootPath is set to EXT:amtstafel/Resources/Private/Partials/
This constant is used in your page.10.templateRootPaths.1

Extension cannot override default (fallback) templateRootPaths/partialRootPaths/LayoutRootPaths

I have two extensions:
Extension "base_templates" contains a lot of fluid Partials
Extension "specific_templates" uses the Partials from "base_templates" and overwrites some of them.
So fluid should use the following order:
1. Check if "specific_templates" has the searched partial
2. Check if "base_templates" has the search partial
So "base_templates" is a fallback for "specific_templates".
To achieve this behaviour I configured partialRootPaths of "specific_templates":
plugin.tx_specific_templates {
view {
partialRootPaths {
10 = EXT:base_templates/Resources/Private/Partials/
20 = EXT:specific_templates/Resources/Private/Partials/
}
}
}
Since the partialRootPaths.0 is always set to EXT:specific_templates/Resources/Private/Partials/ they always get overwritten by Partials in
Wanted result:
array (
0 => 'BASE_PATH/www/typo3conf/ext/base_templates/Resources/Private/Partials/',
1 => 'BASE_PATH/www/typo3conf/ext/specific_templates/Resources/Private/Partials/',
)
It works correct for TYPO3 7.x and after update to 8.x not work as expected.
I had the same problem when migrating from Typo3 v7 to v8.
I had to alter my TS setup as follows:
plugin.tx_specific_templates {
view {
partialRootPaths >
partialRootPaths {
0 = EXT:base_templates/Resources/Private/Partials/
1 = EXT:specific_templates/Resources/Private/Partials/
}
}
}

TYPO3 8.7.8 restrict available content-elements in backend-layout column

I've been searching over and over but yet haven't found something that would work...
TYPO3 8.7.8
root - backend-layout ("Main") for this and all subpages (id=1)
|
- home - backend-layout ("Home") for this page only (id=2)
|
- subpage - same backend-layout as root (id=3)
both backend-layouts look the same:
________________________________
| Top |
|______________________________|
| main-content | right-content |
|______________|_______________|
The top-section is named differently and to be used differently.
The top-section of the "Main"-backend-layout should have only allowed the images-content-element.
cType.allowed = image
The top-section of the "Home"-backend-layout should have only allowed the text-content-element
cType.allowed = text
The last two things I've tried is
first: restricting it using the GlobalVars in typoscript
[globalVar = TSFE:id != 2]&&[globalVar = TSFE:colPos=2]
TCEFORM.tt_content.CType.removeItems := addToList(header,text,bullets,table,uploads,multimedia,mailform,search,login,splash,menu,shortcut,list,script,div,html,media)
TCEFORM.tt_content.CType.keepItems := addToList(image)
[end]
second: changing the properties of the layout in the database
backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = Parallax
colspan = 2
colPos = 2
# The following 3 lines have been added through me
cType {
allowed = text
}
}
}
}
2 {
columns {
1 {
name = Content-Main
colPos = 0
}
2 {
name = Content-Right
colPos = 1
}
}
}
}
}
I've tried quite a few other things and I'm not sure if I would find them again. I'm not even sure this can be done in TYPO3 8.x. The options from creating a backend-layout in typo are really restricted. You can only type a name for the column and define the colPos.
Did I do something wrong for TYPO3 8.x that my configurations didn't work?
Do I need different properties? Or is it just not intended to work this way anymore in this version of TYPO3? Because it seems that it has worked before...
I'm still quite a novice to TYPO3 and I would really appreciate your help but be specific on where to change what because otherwise I'll be lost again.... ^^
Thanks!
Thanks to Joey I found the extension to work with: Content Defender
And I found out how to add my backend_layouts through ts; Add the following to the PageTS of the root page
mod.web_layout.BackendLayouts {
Home {
title = Home
config {
backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = Parallax
colspan = 2
colPos = 2
# allowed and disallowed only work through the extension content_defender (or gridelements)
allowed {
CType = gi_customstyler_parallax_content
}
}
}
}
2 {
columns {
1 {
name = Main
colPos = 0
disallowed {
CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
}
}
2 {
name = Right
colPos = 1
disallowed {
CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
}
}
}
}
}
}
}
}
Main {
title = Main
config {
backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = Titel-Hintergrund
colspan = 2
colPos = 2
allowed {
CType = gi_customstyler_bg_image
}
}
}
}
2 {
columns {
1 {
name = Main
colPos = 0
disallowed {
CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
}
}
2 {
name = Right
colPos = 1
disallowed {
CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
}
}
}
}
}
}
}
}
}
This way the two backend_layouts are available on the page-configurations with the additional conditions of restricted content-elements. As you can see, this can also be used with custom content-elements.
It took quite a while for me to figure this out (as novice) and I hope that this might help someone else...
Try something like this :
backend_layout {
colCount = 2
rowCount = 2
rows {
1 {
columns {
1 {
name = Parallax
colspan = 2
colPos = 2
allowed = text
}
}
}
2 {
columns {
1 {
name = Content-Main
colPos = 0
}
2 {
name = Content-Right
colPos = 1
}
}
}
}
}
You are on the good way, but the condition is not correct.
Prolbem one: There is no TSFE available for the BE.
In the "globalString" condition, key "TSFE:" will not work because the
TSFE global object only exists in the FE context. The "LIT:" key will
not work either as it is used to compare TypoScript constants, which
are not available in the BE context.
Reference: https://docs.typo3.org/typo3cms/TSconfigReference/Conditions/Index.html
You need to use the "page" instead of the "TSFE:page|". These are equal, but "page" can be used for both frontend and backend but "TSFE" is only for frontend.
The second problem is, that for the colPos you need to access the GP (GetPost) helper instead of the TSFE.
So try to change the condition like this:
[page|uid != 2]&&[globalVar = GP:colPos==2]
TCEFORM.tt_content.CType.removeItems := addToList(header,text,bullets,table,uploads,multimedia,mailform,search,login,splash,menu,shortcut,list,script,div,html,media)
TCEFORM.tt_content.CType.keepItems := addToList(image)
[end]
Note: there is no CType restriction for the BE layouts, so both "cType" and "allowed" are wrong.

best way to overwrite a extension template

what is the best way to overwrite the standard template of typo3 extensions so that they are save for updates?
thanks
Tried this:
plugin.tx_news {
view {
templateRootPath = fileadmin/webdesign/templates/news/Templates/
partialRootPath = fileadmin/webdesign/templates/news/Partials/
layoutRootPath = fileadmin/webdesign/templates/news/Layouts/
}
}
But nothing has changed
Here is an example from the tx_news doc:
The TypoScript Setup syntax looks like this:
plugin.tx_news {
view {
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
1 = EXT:fileadmin/templates/ext/news/Templates/
}
partialRootPaths {
0 = EXT:news/Resources/Private/Partials/
1 = fileadmin/templates/ext/news/Partials/
}
layoutRootPaths {
0 = EXT:news/Resources/Private/Layouts/
1 = fileadmin/templates/ext/news/Layouts/
}
}
}
Doc tx_news:
https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Templating/Start/Index.html
typo3 Doc:
https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/Configuration/OverridingFluidTemplates/Index.html
Here another example from slickcarousel:
https://gist.github.com/misterboe/5de7498e810ebd57f7bfb4d2a7abeb66
Important to Know:
in TYPO3 CMS 6.2 and before you can just Overwrite the settings
templateRootPath = /path/to/you/template
in TYPO3 CMS 7.6 and later you can crate an Array where Fluid / TYPO3 is looking for the template. The Naming is different (now ends with an "s" ) and it must be an Array.
So OLD Examples for Version 6.x will not work in 7.6!
templateRootPaths {
0 = /path/to/originalExtension/template
1 = /path/to/you/template
}
same for partialRootPath -> now partialRootPaths and also layoutRootPath -> now layoutRootPaths
The advantage of this new Array: if you only want to overwrite ONE Partial or one Template: create the Directory in your own extension or Fileadin Folder and just put this one, changed File there
-> the filename should still be Identically
-> Look for CamelCase Errors (f.e. folder Name should be "Layouts" and not "layouts" .. this may work in windows Test System but not on production with linux ..
-> clear the TYPO3 cache .. as always ..