Is it possible to reorganize the default CEs in another Groups? - typo3

I would like to group several default typo3 CE into one group.
Is it possible?

The New Content Element Wizard can be changed with Page TSconfig. For example if you want the content element type html in the first tab, you can do the following:
mod.wizards.newContentElement.wizardItems.common {
elements {
html < mod.wizards.newContentElement.wizardItems.special.elements.html
}
show := addToList(html)
}
You can add a tab and fill it with an existing element like this:
mod.wizards.newContentElement.wizardItems.myTab {
header = My tab
elements {
html < mod.wizards.newContentElement.wizardItems.special.elements.html
}
show = html
}
To remove the existing type from its original tab, add:
mod.wizards.newContentElement.wizardItems.special.show := removeFromList(html)
More on this you can find here: https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/Mod.html#newcontentelement-wizarditems

Related

Typo3 Content Elements missing in wizard

I have some content elements in a site package which I want to show up in the content element wizard as explained here:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/ContentElementsWizard.html
Basically I have done the same as shown in the section "Create a new tab"
Configuration\TsConfig\Page\ContentElement\All.tsconfig is looking like this:
mod.wizards.newContentElement.wizardItems.mci.header = MCI
mod.wizards.newContentElement.wizardItems.mci {
elements {
mci_home_banner {
iconIdentifier = home-banner
title = Home-Banner
description = Banner der Startseite
tt_content_defValues.CType = mci_home_banner
}
mci_home_banner_element {
iconIdentifier = home-banner-element
title = Home Banner Element
description = Element im Starseitenbanner
tt_content_defValues.CType = mci_home_banner_element
}
}
show := addToList(mci_home_banner, mci_home_banner_element)
}
I reduced the code to just 2 elements. They are not shown at all, but are available over the dropdown, so I can switch to one of them after choosing another element.
This didn't work when created in 9.5 and still does not work after switching to version 11.5.10
What am I missing?
#user414873 Did you try to add your custom elements to the "common" tab instead of your new one "mci"?
And did you try to use an existing icon identifier (e.g. "content-image" or an other one - see https://typo3.github.io/TYPO3.Icons/)? Just to make sure that there is no problem with your custom icons that prevents the elements from being displayed.
Does this minimal example work for you:
mod.wizards.newContentElement.wizardItems.common {
elements {
mci_home_banner {
iconIdentifier = content-image
title = Home-Banner
description = Banner der Startseite
tt_content_defValues.CType = mci_home_banner
}
}
show := addToList(mci_home_banner)
}
And I would doubt this:
I guess otherwise the content elements wouldn't be available at all.
I suggest you check it's correctly included by using the "Info" module in your TYPO3 main menu. Then select the page where the content element should be included and switch the dropdown on top of the content area to "View TSconfig fields content". Now you can search for "wizards" and check if your element is included.

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

Add custom elements to TYPO3 as hidden by default?

I have an installation with multiple websites. Each site has a site package with custom fields and content elements that are specific to that site.
But the custom fields and content elements are shown on all sites.
In tt_content.php I add a custom element to the type dropdown. How can I make it hidden, then enable it in ts config for the page tree that it is used for?
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'Banner',
'my_extension_banner',
'EXT:core/Resources/Public/Icons/T3Icons/content/content-image.svg'
],
'textmedia',
'after'
);
Likewise, I have some custom fields added to existing elements. How can I make this field hidden unless specifically enabled by the ts config of the page that it is made for?
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tt_content',
'headers',
'--linebreak--,my_extension_myfield',
'after:subheader'
);
After some trial and error, I found that I can remove elements and fields globally by adding this to my ext_localconf.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
#Remove Custom Content Elements
TCEFORM.tt_content.CType.removeItems := addToList(my_extension_banner)
#Remove Custom Fields
TCEFORM.tt_content {
my_extension_myfield.disabled = 1
}
');
Then add them in again with my page specific ts config file PageTSConfig.tsconfig
#Add Custom Content Elements
TCEFORM.tt_content.CType.removeItems := removeFromList(my_extension_banner)
#Add Custom Fields
TCEFORM.tt_content {
my_extension_myfield.disabled = 0
}
I don't know if I understand the problem correctly, but you could place Page TsConfig in the root page of any web page and then hide the fields accordingly:
TCEFORM.pages {
subtitle.disabled = 1
}

Create a new link stye in Typo3?

Is there a way to add a new style to the Insert Link dialog in Typo3?
Currently they are "internal-link", "internal-link-new-window", or no style.
I have tried putting various things in the Page tsconfig with no results at all...
I found this on another site which looks like it does what I want but I can't get it to do anything:
RTE.classesAnchor {
tollerLink1 {
class = button
type = page
titleText = Button
}
}
RTE.default {
classesAnchor:=addToList(button)
}
In your TsConfig (Home Page Properties - Resources - Page TSConfig)
RTE.default.buttons {
link.properties.class.allowedClasses := addToList(internal-link-new-window)
}

Neos 2.0 Breadcrumb menu: How to skip first two levels?

I need to display a breadcrumb menu where the first two levels are skipped.
Menus of type Menu have a property entryLevel to control where the menu starts, but it seems that is not the case for Breadcrumb. (At least it has no effect.)
Is there a way to accomplish this in Neos?
Breadcrumb is defined in TYPO3.Neos/Resources/Private/TypoScript/Prototypes/Breadcrumb.ts2 and you can overwrite values from there in Root.ts2 in your site package. So you can change templatePath and handle it using iterator in f:for or even better just limit (slice) items you pass to template on TS2 level. Translating it to code, you have Your.Site.Package/Resources/Private/TypoScript/Root.ts2 and there your page definition, just change Breadcrumb part:
page = Page {
...
body {
templatePath = 'resource://Your.Site.Package/Private/Templates/Page/Default.html'
sectionName = 'body'
parts {
menu = Menu
breadcrumb = Breadcrumb {
# replace items with itemCollection if you're using BreadcrumbMenu (Neos 2+)
items = ${q(node).add(q(node).parents('[instanceof TYPO3.Neos:Document]')).slice(0, -2).get()}
}
}
...