TYPO3: Site Configuration Data inside TSconfig Condition - typo3

The divider content element is disabled for all pages via TCEFORM.tt_content.CType.removeItems := addToList([…], div) in PageTSconfig. This works just fine.
Now I want that the divider is only available for a certain subset of pages.
I defined the uppermost page in my site configuration which leads to the following Typoscript:
[site("configuration")["settings"]["pages"]["simpleLanguage"] and site("configuration")["settings"]["pages"]["simpleLanguage"] in tree.rootLineIds]
TCEFORM.tt_content.CType.removeItems := removeFromList(div)
[END]
Now when I want to insert an divider on that given pages, I can choose it from the NewContentElement Wizard, but when the form of the content element gets rendered the divider is missing in the CType select.
Divider is shown in NewContentElement Wizard
But not in the content element form.
I found out that when setting the pageuid directly, the condition is evaluated fine.
So my conclusion ist that I cannot get site information inside TSconfig.
So how can I get the information from the site config inside TSconfig?

Conditions in PageTS have been fixed for TYPO3 v10 with https://forge.typo3.org/issues/89718.
The patch has not been backported to v9 due to its complexity.

The new content element wizard uses another configuration:
https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/Mod.html#newcontentelement-wizarditems
# PageTS
# CType "div" is in group "special"
mod.wizards.newContentElement.wizardItems.special.show := removeFromList(div)

Related

TYPO3 hide content element options in wizard

I want to show only the column options from the grid elements tab to the editors group when they create a new content element. So I tried to edit the groups TSconfig.
tx_gridelements.setup.tabs4 >
tx_gridelements.setup.tabs6 >
This has no effect. How do I remove all but the column options?
Update: With your help I figured out that my problem is not about the text in the TSconfig but that it is not loaded from the backend user group nor the beuser.
The elements you want to disable are located in Page TSconfig under mod.wizards.newContentElement.wizardItems. You can see them in the "Info" module under "Page TSconfig" :
You can simply disable them by adding
# example for the given screenshot
mod.wizards.newContentElement.wizardItems.common.elements.header >
I don't think that the answer from #statix will work with grid elements.
But in the settings of your backend layout, you can define what type of content elements are allowed within a specific content area:
And within the settings of each grid element you can define again, which content elements are available, e.g. to prevent nesting of grid elements.
Put this code in root page tscPage TSConfig
tx_gridelements.excludeLayoutIds=your grid id
May It helps you!!

Hide specific elements on page (Typoscript)

Is there some way how to hide specific elements on specific page using Typoscript in TYPO3?
The URL is for example: www.mywebsite.com/subpage1
I want to hide menu and footer part only on this subpage1.
Thank you
If the menu and footer are created through TypoScript you can use conditions in TypoScript to overwrite them. For example:
lib.footer = TEXT
lib.footer.value = This is my footer
[globalVar = TSFE:id = 4]
lib.footer >
[global]
In this example the uid of the page where I want to not show the footer is 4.
More on conditions in TypoScript can be found here: https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html
A clean way would be to define different page-layouts and assign them to the pages where these elements are not desired. With fluid partials you could recycle most parts of the page and depending on the layout render footer and menu.
As you get a nice inheritance mostly the fields backend_layout and backend_layout_next_level are used. You will find a lot of examples.
fluid handling could be found in typoscript backend_layout_next_level not working.
For templa voila (=TV) you can use a similar attempt: select different TV-templates depending on these fields.
Duplicate the given template, remove footer and menu and insert the new template to the set of given templates.

How to get the Log In Form on every page? (for example in footer) Typo3

Is there a way to get the Log In Form for Frontend User on every page? I would prefer the footer.
And if someone is logged in you can see the Log Out Button.
Is this possible without an extension?
You can copy the default felogin output to wherever you want on your template. For example use lib.login, copy the plugin.tx_felogin_pi1 into it, change the template and you're fine.
lib.login < plugin.tx_felogin_pi1
lib.login.templateFile = path/to/your/template/file
More you can see in the official documentation: https://docs.typo3.org/typo3cms/extensions/felogin/8.7/Configuration/Index.html
In general there are three options to include a CE (e.g. the Login-form) on all pages:
use typoscript to generate the CE. Normally the CEs are defined in tt_content, from where you could copy the base configuration and adapt it. For some plugins you also find a complete configuration beyond lib (for newer extensions there you only find the settings). All the configuration must be done in typoscript.
use typoscript to render the content of a special page/ column. In this variant you have a special page only for content referenced somewhere else. Advantage: you could configure the CE in the usual way. Try to avoid referencing CEs by uid as an editor might disable or delete the current element(s) and insert a new one which would not be rendered.
use a special column in your root page and inherit the content to all subpages. Advantage: you could change the inherited content easily on each page (if this column is available in the current backend layout).
example for 3:
variables {
footer_content < styles.content.get
footer_content.select.where = colPos = 15
footer_content.slide = -1
}

how to disable fields in tca only for certain ctypes

I want to disable certain fields in the backend, e.g. many fields of gridelements and other content elements. I know about the possibilities of TCEFORM but it allowes only to disable a field in all cTypes. I need a way to disable certain field only for certain cTypes.
Is there a way to achieve this?
Thanks
You have full control over which field are shown, if you adapt TCA for tt_content. You can override TCA with your customer extensions (sitepackage).
The following file contains fields, which are shown for CType header (TYPO3 CMS 7.6)
EXT:sitepackage/Configuration/TCA/Overrides/tt_content.php
<?php
defined('TYPO3_MODE') or die();
call_user_func(function () {
$GLOBALS['TCA']['tt_content']['types']['header']['showitem'] = '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,rowDescription,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended,--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category,categories';
});
Remove or add any fields after your needs and do so for any CType you wish to change.
See also https://docs.typo3.org/typo3cms/TCAReference/7.6/Reference/Types/Index.html
Meanwhile (since 9 LTS) it is possible via TsConfig:
TCEFORM.tt_content.subheader.types.text.disabled = 1
… disables the subheader field for all text content elements.
You can even disable a field for all cTypes and define an exception:
TCEFORM.tt_content.subheader{
disabled = 1
types.text.disabled = 0
}
As long as you don't need additional conditions like i.e. a certain user or group or a particular branch of the page tree to disable these fields, you should not go for PageTSconfig and TCEFORM but pure TCA types instead.
Just create a site package extension, which would be recommended anyway, and make sure to provide the desired setup for the tt_content table within Configuration/TCA/Overrides/tt_content.php so it will be applied automatically.
You can find some slides about the "Anatomy of Sitepackages" here: https://de.slideshare.net/benjaminkott/typo3-the-anatomy-of-sitepackages
Additional information about the TCA types can be found here:
https://docs.typo3.org/typo3cms/TCAReference/Types/Index.html
As Gridelements just provides mandatory fields for layout, children, container and column, you should not disable these fields though, since it might break the functionality.

How to hide the output comming from an inherited content element?

On a sub page I am inheriting multiple content elements from a parent page. Now I need to hide one of them, while keeping the rest untouched.
Any ideas?
One idea would be to use TypoScript to hide the output from the respective content element or plugin.
Identify the responsible element for the output using TYPO3 ADMIN PANEL.
Create a new template for the page (List view) and add the necessary configuration in the Setup field.
Below is an example:
[globalVar = TSFE:id = YOURPAGEID]
plugin.tx_exampleplugin >
[global]