How to change Typo3 Backend layout Name using TypoScript? - typo3

By default typo3 Back end layout give Normal,Left,Right and Border.
To hide the blocks i used following code
mod.SHARED.colPos_list = 0,1,2
How to rename the blocks in Typo script:
Normal - Description
Left- News
Right - Publications
Border - Footer

When inserting the following in the Page TSConfig of the root page, the values of the dropdown "Columns" are changed when editing content elements:
TCEFORM.tt_content.colPos.altLabels {
0 = News
1 = Description
2 = Publications
3 = Footer
}
Unfortunately, this is only halfway :(
According to Spalten ändern und umbenennen you'll need to edit typo3conf/extTables.php which affects all pages in the tree:
t3lib_extMgm::addPageTSConfig('
mod.SHARED.colPos_list = 0,1,2,3
');
$TCA["tt_content"]["columns"]["colPos"]["config"]["items"] = array (
"1" => array ("News||||||||||","1"),
"0" => array ("Description||||||||||","0"),
"3" => array ("Publications||||||||||","3"),
"2" => array ("Footer||||||||||","2"),
);

If you're using TYPO3 4.5+, you can use the new feature called backend layout or grid view.
It is very easy to use. You don't have to edit PHP-code. You just have to configure it using a wizard.
Joey Hasenau has written a good article at news.typo3.org about how to use the backend layout.
I hope, this facilitates your daily work!

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 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
}

TYPO3 CMS 7 tt_content layouts

I set up my own tt_content layout in TSconfig like
TCEFORM.tt_content.layout.removeItems = 1,2,3
TCEFORM.tt_content.layout.addItems.100 = Green Box
and added the class definition to my typoscript setup like
# Layout Green Box (100)
tt_content.stdWrap.innerWrap.cObject{
100=<tt_content.stdWrap.innerWrap.cObject.default
100.15.value = greenbox
}
in TYPO3 CMS 7.6.9. But it nothing happens in the frontend. The Layout "Green Box" appears in the Appearance > Layout dropdown but the class does not.
Did I something wrong or is there a new way since the fluid layouts in 7+ version?
In fact it needs to be defined in your own fluid template.
So what you do is to copy the private folders of fluid_styled_content to your own private folder of your distribution and added some lines to your typoscript constants like
styles.templates {
templateRootPath = {$resDir}/Private/Tt_content/Templates
partialRootPath = {$resDir}/Private/Tt_content/Partials
layoutRootPath = {$resDir}/Private/Tt_content/Layouts
}
In my case I edit the second line of Textmedia.html to
<div id="c{data.uid}" {f:if(condition: '{data.layout} == 100', then: 'class="greenbox"')}>
and et voila it works fine.
A little late, but somebody might still find this useful.
If you're using css_styled_content, then yes, it changes slightly in new versions.
Basically the structure looks now some like this:
stdWrap.innerWrap.cObject.[default|NN] {
# 10 - OPEN TAG
10.cObject.default.value = <div id="c{field:uid}"
# 20 - CLASS
20.10.value = csc-default
# 30 - CLOSE TAG
30.cObject.default.value = >|</div>
}
Differences between versions:
# overwrite basic settings for selected frame:
stdWrap.innerWrap.cObject.[NN (layout number or default)]
# for open tag: instead of NN.10.value (default.10.value) use: NN.10.cObject.default.value (default.10.cObject.default.value)
# for class: instead of NN.15.value (default.15.value) use: NN.20.10.value (default.20.10.value)
# for close tag: instead of NN.30.value (default.30.value) use: NN.30.cObject.default.value (default.30.cObject.default.value)
So in asked case it will be like this:
# Layout Green Box (100)
tt_content.stdWrap.innerWrap.cObject{
100 =< tt_content.stdWrap.innerWrap.cObject.default
100.20.10.value = greenbox
}

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()}
}
}
...

TYPO3: Trying to add link to images

On our site, other admins add images via the "Resources" tab of the main page. These images are displayed as Banners in a Slider on the main page. However, now they want the ability to add links to specific images.
My first thought on this (after receiving some help on making a loop for images to be added to the page) was to perhaps let them be able to add the link to either the "Title" or "Caption" spot I saw there. And later, on the slider "create" function, pull the said data from the image and make <a> wrap around the image before the slider finished building. I've already tested the slider plugin with this functionality, and that would work fine, however, I can't seem to pull anything from the "Title" or "Caption" and add it to the image in any way.
My other thought would be, is there a way to extend the back end to give them an actualy spot to paste links on images so that I may pull that and wrap the image via the typoscript, or can i pull from caption and wrap image in <a> "if" the link is available.
In other words, does typoscript have a type of "if" statement? What I ahve so far, thanks to maholtz is as follows:
#BANNER IMAGES LOOP BEGIN
page.10.marks.topimage = TEXT
page.10.marks.topimage {
# retrieve data
data = levelmedia: -1, "slide"
override.field = media
# we have some filenames in a list, let us split the list
# and create images one by one
# if there are five images selected, the CARRAY "1" will be executed
# five times where current is loaded with only one filename
split {
# the images are separated via ","
token = ,
# you can do funny stuff with options split, f.e. if you want to give first
# and last image a different class... but thats another topic;)
# we just say, render every splitted object via CARRAY "1"
cObjNum = 1
1 {
# just render the single image,
# now there should be one filename in current only
10 = IMAGE
10 {
file.import.wrap = fileadmin/user_upload/|
file.import.current = 1
border = 0
file.height = 670
file.width = 1800
altText = Banner
titleText = Banner
# attempt to add link to image if available
caption.1.typolink.parameter.field = image_link
caption.1.typolink.parameter.listNum.stdWrap.data = register:IMAGE_NUM_CURRENT
}
}
}
wrap = <div id="slides">|</div>
}
#BANNER IMAGES LOOP END
I was thinking perhaps I could do something like:
10 {
file.import.wrap = fileadmin/user_upload/|
file.import.current = 1
border = 0
file.height = 670
file.width = 1800
altText = Banner
titleText = Banner
# attempt to add link to image if available
caption.1.typolink.parameter.field = ???
caption.1.typolink.parameter.listNum.stdWrap.data = register:IMAGE_NUM_CURRENT
}
But as you can see, I'm stumped on how that might even work right. Can anyone help point me the right way.
As before mentioned, perhaps I could do ONE of two things:
Pull link from "Title" or "Caption" and add it to the IMAGE Date on output so that I can use that client side to wrap the image in appropriate a tag, |OR|
Pull link from there and use typoscript to wrap the image in a tags
When accessing the ressources via levelmedia = slide you're not directly accessing the FAL table. Therefore you have to load it again to access the fields you want. We solved exactly the problem you have with the following code. Insert it inside your 1 after 10 = IMAGE.
typolink{
parameter{
cObject = RECORDS
cObject{
source.current = 1
tables = sys_file_reference
conf.sys_file_reference = TEXT
conf.sys_file_reference.field = #title or description
}
}
}