TYPO3: re-define altLabels in TCEFORM for layout with multisite - typo3

I use EXT:T3sBootstrap and define comprehensible voices for the layouts the editors may select ... this works fine with the following code:
ext_localconf.php :
# Set TCEFORM features
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:myExt/Configuration/PageTSConfig/TCEForm.ts">');
Configuration/PageTSConfig/TCEForm.ts :
TCEFORM {
tt_content {
layout {
addItems {
4 = special box
100 = extra
}
altLabels {
0 = Default
1 = image shadow
2 = line shadow
3 = line shadow inv
}
disableNoMatchingValueElement = 1
}
}
}
in my second site I want to be able to re-define these labels with comprehensible voices but, although the static template of the first site is not included, it takes this configuration and does not use the one I just defined in the new myExt ...

(Page) TSconfig is loaded independent from the TypoScript static templates. The way you currently load the TSconfig into TYPO3, it will be used for all websites in this TYPO3 instance. So, the TSconfig from your second site is simply overwritten by your first configuration shown above.
Since TYPO3 v7, you can use registerPageTSConfigFile to add TSconfig settings as needed into your different page trees and websites:
your_extension/Configuration/TCA/Overrides/pages.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
'your_extension',
'Configuration/PageTSConfig/TCEForm.ts',
'My TCEform config including custom altLabels'
);
This enables you to select the TSconfig in the page properties, where it will apply for all subpages.
You can find a working example here.

Related

typo3 add content element to all pages that are direct child of a certain page using typoscript

I have defined a menu content element using typoscript:
lib.share = COA
lib.share {
wrap = <div class="shareLinkBlock">|</div>
1 = TEXT
1.data = page : title
...
I would like to add this menu to colPos 2 of every page, that is direct child of a certain page.
Is there any way to achieve that?
Thanks a lot!
A solution depends on the current realization of the page.
If you use only typoscript you can replace the colPos2 rendering with a COA where your typoscript is part one and the old rendering is a second part.
Using conditions can restrict the appearance to selected page trees.
In similar ways you can realize it with FLUID.
You can insert a fluid variable, filled with your typoscript in every page.
The restriction to special page trees can be realized with conditions in typoscript or in FLUID. Also you can use different page-layouts for pages with and without this menu.
another solution would be an additional backend column which gets inherited and where you fill in your menu for those pages where the menu starts being visible. (conditions like above)
EDIT:
if you want to enhance a given FLUID variable, defined in typoscript you can word with a COA:
:
10 = FLUIDTEMPLATE
10 {
:
variables {
enhancedColumn = COA
enhancedColumn {
10 = ..old definition ...
}
}
}
:
// make sure you use the correct conditions:
[PIDinRootline = 10]
...10.variables.20 < lib.footer
[global]

setup.txt / setup.typoscript not being loaded in module

I'm writing an extensio in Typo3 9.5 and I can't get the setup.txt or setup.typoscript to load.
I am trying to add a second page type that renders only JSON. For that I gather I need to change the typoscript. Therefore I added this code to my setup.typoscript:
ajax_ajaxjson = PAGE
ajax_ajaxjson {
typeNum = 1
config {
disableAllHeaderCode = 1
additionalHeaders = {
10 {
header = Content-Type: application/json
replace = 1
}
}
xhtml_cleaning = 0
debug = 0
no_cache = 1
admPanel = 0
}
10 < tt_content.list.20.tx_energieportal_ajaxjson
}
(in EXT:\Configuration\TypoScript\setup.txt)
Now when trying to load that page type, I get the following error:
TYPO3\CMS\Core\Error\Http\ServiceUnavailableException
The page is not configured! [type=1][]. This means that there is no TypoScript object of type PAGE with typeNum=1 configured.
I also added a test variable, and when rendering that variable with
<f:cObject typoscriptObjectPath="testvar"/>
I get the error:
No Content Object definition found at TypoScript object path "testvar"
I setup my sys_template.php up like this:
<?php
defined('TYPO3_MODE') or die();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'energieportal',
'Configuration/TypoScript',
'Energieportal Frontend'
);
(in EXT:\Configuration\TCA\sys_template.php).
I also tried renaming the setup.txt to setup.typoscript.
Is there anything else I need to do to have my module load the setup.typoscript? I looked at the docs and other modules, but I couldn't find anything for setting up that file.
I used the search function, but the only similar question wasn't really answered. (Link)
If you want to override the TCA of existing tables, you need to put the file into Configuration/TCA/Overrides/.
So, the correct path for your sys_template.php needs to be Configuration/TCA/Overrides/sys_template.php.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile only adds it to the list of static TypoScript files which can be loaded in a TypoScript template. It does not load the TypoScript file automatically.
You will have to include it in a TypoScript template in the TYPO3 backend. You can find the available static templates in the Includes tab under Include static (from extensions).
Alternatively you can include it in a different TypoScript file that is already loaded in the previously mentioned way using #import 'EXT:EXT:energieportal/Configuration/TypoScript/setup.typoscript' or <INCLUDE_TYPOSCRIPT: source="FILE:EXT:energieportal/Configuration/TypoScript/setup.typoscript">
It is also possible to add TypoScript directly from PHP using \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('My TypoScript'), so you can add the #import or <INCLUDE_TYPOSCRIPT...> line there. You can add this in your extension's ext_localconf.php or Configuration\TCA\Overrides\sys_template.php. It is however usually not recommended as you might not want the TypoScript loaded for all pages and/or sites in a TYPO3 installation.

How do you set the default Backend Layout in TYPO3

I am using the method of defining Backend Layouts in a TSconfig file in a site package extension.
mod {
web_layout {
BackendLayouts {
# pagets__onecolumn
onecolumn {
title = One column
config {
backend_layout {
colCount = 1
rowCount = 1
rows {
1 {
columns {
...
etc
I would now like to define one of my own BE-Layouts as default.
I found a method of excluding BE-Layouts (such as "none") in the select list in page properties:
TCEFORM.pages.backend_layout_next_level.removeItems= -1
TCEFORM.pages.backend_layout.removeItems= -1
But what I really want is for TYPO3 to automatically assign my default BE-Layout to new pages (and not use the TYPO3 default).
Using TYPO3 8 (latest version)
In the TYPO3 page records there are two fields for backend layouts on the current page and backend layouts on subpages. The latter is assigned automatically to each of the pages in the tree below the page where you set it.
So you should just assign your default layout as backend layout on subpages within the root page and it will become the default for any page, that hasn't got a layout set itself.
You can override that by selecting another layout on a subpage, that will override the default setting for that particular part of the tree.

How to rename subheader in TYPO3 CMS backend

How can I rename a TYPO3 CMS backend field for authors? i.e. the mentioned field for content-elements of csc_styled_content?
In general, overriding label names can by done with Page TSconfig in the backend. The following example modifies the label of the subheader field.
TCEFORM {
tt_content {
subheader.label = My new Label-Name
}
}
There are two way to configure that adjustment in TYPO3.
Type your configuration changes directly to the page settings » resources » TypoScript Configuration » Page TSConfig (see the screenshot below)
as an alternative you can store that configuration directly in the file system - either in your custom extension (e.g. at typo3conf/ext/my_extension/Configuration/TSconfig/labels.t3s) or with a similar name in the global file storage (e.g. fileadmin/templates/configuration/...)
That's basically it to provide custom labels for any database table in the TYPO3 backend. Find more aspects that can be adjusted in the accordant Page TSconfig documentation.
If you want to rename a field of an extension like tx_news you could do it this way.
TCEFORM {
tx_news_domain_model_news {
title.label = Your New Label
}
}
Now there are two ways to get this to work:
Put it in Page TSConfig of the page settings
OR
Load it with your extension from a file (e.g. EXT:my_extension/Configuration/pageTSConfig.typoscript). For that you have to import this script by EXT:my_extension/ext_localconf.php!
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_extrension/Configuration/pageTSConfig.typoscript">');

ExtBase Detail View in Lightbox

I made an Extension with Extbase and iwant the detail view to be shown in a lightbox and it does. The Problem is: I dont want the main template (of the main page with navigation etc.) to be seen, but just the detailed view. What do I have to change, to exclude the Main Template?
Use dedicated typeNum for this content and in its TS configuration set: disableAllHeaderCode = 1, it can be compared to the common way of rendering pure AJAX types like showed in the other sample.
For an example put this into your TypoScript template
myPurePage = PAGE
myPurePage {
typeNum = 1234
10 < styles.content.get
config {
disableAllHeaderCode = 1
}
}
So if you'll call it by http://yourdomain.tld/?id=123&type=1234 it will show only content of the main column from page with UID 123 (without html, body sections, any navigations from default template, etc, etc)
An alternative to the solution #biesior provided: Use the extension typoscript_rendering. It provides a ViewHelper to generate a link that renders only the view for an extbase action, without the layout.