Define TYPO3 content element layouts for a specific list_type - typo3

In TYPO3 you can define custom Layouts to show up exclusively at
Appearance > Content Element Layout > Layout
for a specific CType like e.g. “gridelements_pi1”. How can i do this for specific list_type (where CType is “list”)?
code example:
TCEFORM {
tt_content {
layout {
addItems {
# layout items for all
}
types {
# CType "gridelements_pi1"
gridelements_pi1 {
addItems {
# layout items only for "gridelements"
}
}
list {
# is it possible to have
# layout items only for list_type "XYZ" ?
}
}
}
}
}

AFAIK it is not possible to limit this to a specific list_type.
CType = End of story (like in your example)
Possible solution: if this is your own extension, you can add your own unique CType instead of just calling it "list".
tt_content_defValues {
CType = your_own_ctype
list_type = extname_pluginname
}

As Mikel already said: there are no more options in the typoscript structure to configure special plugins.
But it might be possible to use conditions which are possible in TSconfig to identify the plugin type in the current context.
I remember an installation where it was used, but I don't remember the exact configuration and whether this still works in newer TYPO3 versions. So unfortunately I have no working example or documentation for this case.

This works
TCEFORM{
tt_content{
layout {
types {
div {
addItems {
30 = Grey
}
}
}
}
}

Related

Add templateLayout option to tx_news sepecific to view type?

Using PageTSConfig I want to add some template options to the tx_news plugin.
How do I make it so that List template options are only shown when list view is active, and the same for Detail template options?
I thought it would be something like this:
tx_news.templateLayouts {
types {
list {
1 = Alt List
}
detail {
2 = Alt Detail
}
}
}
By PageTS it's only possible to handle different list templates, the code must look like this:
tx_news.templateLayouts {
1 = A custom layout
99 = LLL:fileadmin/somelocallang/locallang.xlf:someTranslation
}
For different detail views you need to use TypoScript settings options.
All examples you can see here:
https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/Templates/TemplateSelector/Index.html

How to hide backend layout in folders

In pages of type folder nobody want to add content. It's not meaningful and you get the warning "Go to list module" if you are in page module.
How can I disable the display of "Normal" (name of default column) and the button [+ Content]? It's not useful and confusing for editors.
I tried something with backend layouts but with no success.
Wondering, what you have tried with backend layouts so far.
The following is working since versions (including v10):
mod.web_layout.BackendLayouts {
exampleKey {
title = Example
icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif
config {
backend_layout {
colCount = 0
rowCount = 0
rows {
}
}
}
}
}

How to get the value of TYPO3 backend_layout in your fluid content element?

I need to get the value of the field backend_layout in my fluid content element.
Via <f:debug /> I get the value in my page template, but not at the level of the content element.
try to set the following in setup typoscript for "page":
page {
# e.g. inside your page template "10"
10 = FLUIDTEMPLATE
10 {
# ...
variables {
# access this with {layout} in your fluid templates
layout = TEXT
layout {
data = levelfield:-2,backend_layout_next_level,slide
override {
field = backend_layout
}
}
}
}
}
The easiest way is to use the vhs extension and the view helper v:page.info available there or pass the variable somehow (TypoScript, register, etc.) down to your content elements.

Override a Fluid Template from another extension

I'm working on a TYPO3 webpage for a magazine. Therefore I'm using the extension "news" or "tx_news".
Everything works fine, except that I'm confused how and where to override the given fluidtemplates from the news extension. For the webpage I'm using an own extension to keep all the backend layouts and fluid templates stored, I would like to include an own fluidtemplate for the News as well inside my extension, so the changes I make won't get overriden when I update the news extension of course.
I've tried just copy pasting the fluid templates from the news into my extension with the hope that they get overriden, since my extension has the highest priority in the backend. Also I found on the documentation that I should add the following lines into my TS setup:
plugin.tx_news {
view {
templateRootPaths >
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
1 = fileadmin/templates/ext/news/Templates/
}
partialRootPaths >
partialRootPaths {
0 = EXT:news/Resources/Private/Partials/
1 = fileadmin/templates/ext/news/Partials/
}
layoutRootPaths >
layoutRootPaths {
0 = EXT:news/Resources/Private/Layouts/
1 = fileadmin/templates/ext/news/Layouts/
}
}
}
I have added those lines at the bottom in the setup.txt of my own extension with customized paths of course and it didn't work either.
I appreciate all the help.
You missed to declare the pathes to your version of the templates.
you have two ways:
use the constants ext:news provides you and inserts automatically in the TS setup
add some lines direct to the plugin configuration.
As you use an page extension for all configuration you would avoid the TS constant editor or use it only to identify the names of the constants.
// Path constants from ext:news:
plugin.tx_news {
view {
layoutRootPath = EXT:yourextension/Resources/Private/News/Layouts/
partialRootPath = EXT:yourextension/Resources/Private/News/Partials/
templateRootPath = EXT:yourextension/Resources/Private/News/Templates/
}
}
Anyway you should end up with a TS like this (inspect with TSOB):
plugin.tx_news {
view {
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
1 = EXT:yourextension/Resources/Private/News/Templates/
}
partialRootPaths {
0 = EXT:news/Resources/Private/Partials/
1 = EXT:yourextension/Resources/Private/News/Partials/
}
layoutRootPaths {
0 = EXT:news/Resources/Private/Layouts/
1 = EXT:yourextension/Resources/Private/News/Layouts/
}
}
}
If you use method 2 you could use higher values to give your templates higher priority - in case multiple extensions and template replacements are active.
This configures the pathes for the layouts, partials and templates you are overriding:
Resources
+- Private
+- News
+- Layouts
+- Partials
+- Templates
in your extension.
Don't use the TS from your question (even if it comes from the original manual.)
It deletes the predefined pathes. (Lines 3,8,13). This might fail after an update where the internal pathes have changed.
Copy only templates from EXT:news in your extension which you
want to change. Your example TypoScript works as fallback and templates missed in 1 are searched in 0.
Overwrite only TypoScript that you want to change.
Then use TypoScript Object Browser and check the TypoScript setup for
plugin.tx_news.view...
If you don't see right paths the order of TypoScript loading must be
changed.

Configuring Single RTE Wrapper for Multiple Classes - Typoscript/Typo3

I'm trying to write Typoscript that will configure the Typo3 Rich Text Editor to wrap a given element with more than one class.
In the project's TsConfig/Page/rte.txt file, I have:
RTE {
classes {
button {
name = Button
}
}
However, I'd like to create a wrapper that would give the element more than just a single class. The below code doesn't work, but illustrates what I'm trying to accomplish:
RTE {
classes {
button {
name = Button
}
button danger {
name = Dangerous Button
}
}
According to this article, this doesn't seem to be possible, but I thought I'd ask and see if someone out there got crafty with their Typoscript and was able to accomplish this.
I tried everything to handle styles for tables that way, but there is currently no way to handle more than one CSS-Class for a RTE style definition.
The only way to handle this, is creating new CSS classes and extend the available button styles via LESS or SCSS.
In TYPO3 7 you can use this following RTE configuration to use multiple classes. The magic happens in the class-definition with the attribute "required"
RTE {
default {
proc.allowedClasses := addToList(btn-dark)
buttons.link.properties.class.allowedClasses := addToList(btn-dark)
}
classes.btn-dark {
name = Dark-Button
requires = btn btn-small
}
classesAnchor.buttonDark {
class = btn-dark
type = page
}
}