TYPO3 TCA how to set pages max title length - typo3

our customer needs super long page titles. in the backend i found Configuration > TCA > pages > columns > title > config > max
so this would be the correct setting to increase the page title length right? but where can i add the mandatory TCA to increase the length and how would it look like?
help is much appreciated

You can override the TCA settings with PageTS (TCEFORM).
Documentation is here: https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/TceForm.html
Example for your issue:
TCEFORM.tt_content.header.config.max = <your value>
But be sure that the table field in the DB may be increased as well.
Then you need to add an ext_tables.sql file in your sitepackage extension and add:
CREATE TABLE pages (
title VARCHAR(<your value) DEFAULT '' NOT NULL
);

Are you sure that this is correct?
My approach is this:
TCEFORM.pages.title.config {
max = 250
size = 250
}
It also works in the form, but it still gets truncated on save.
I have deleted caches.
What have I overlooked?

Related

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 limit tx_news teaser and bodytext length in Backend TCA?

For limiting the maximum length of a news title, i can use this tsConfig setting:
TCEFORM.tx_news_domain_model_news.title.config.max = 70
Is it possible to set such a limitation also for teaser and bodytext of news records? Since these are not simple input fields but textareas or RTE fields, it doesn´t seem to be that easy to limit their length. Is it possible nevertheless?
max does not apply to RTE fields. You can try to limit the length in an editor plugin, e.g. CK Editor Plugin (for TYPO3 8).
Keep in mind that there is not server side length validation.
Look at typo3conf/ext/news/Resources/Private/Partials/List/Item.html here you can find the setting settings.cropMaxCharacters, so if you set plugin.tx_news.settings.cropMaxCharacters = 150 your text displayed with max 150 Chars.
Your Typoscript is correct for title and syntax is also correct: TCEFORM.[table name].[field].config.[key] = value
TCEFORM.tx_news_domain_model_news.title.config.max = 70
If you want set limit for bodytext and teaser then try to below typoscript
TCEFORM.tx_news_domain_model_news.bodytext.config.Type = TEXT
TCEFORM.tx_news_domain_model_news.bodytext.config.Rows = 2
Also Add this typoscript in Root Page TSConfig.
More Details. Click Here

How to customize field size in TYPO3 BE

I'm using TYPO3 since version 3 but I have never tried to customize the TYPO3 BE.
Now, what annoys me more in the BE is that in 'Special Menus' the 'Selected Pages' field displays 3 lines by default. I wish to expand it to at least 10 lines.
Inspecting the BE page with FF Developer Tools shows:
<select id="tceforms-multiselect-57f39f13067b0673730065" size="3" class="formField.
Editing the size value to 10 in the Inspector is exactly what I need.
How could I change that size value in TYPO3?
#Markusson and #Vimal Usadadiya
As suggested deactivating and activating the extension did the trick. BTW no need to use Global. The code I put in ext_tables.php is:
$TCA['tt_content']['columns']['pages']['config']['size'] = 10;
You can override the default value by using below lines. You can put that lines into ext_tables.php file in your custom extension.
unset($GLOBALS['TCA']['table_name']['columns']['field_name']['config']['size']);
$GLOBALS['TCA']['table_name']['columns']['field_name']['config']['size'] = 10;
You can override this in your own extension via
$GLOBALS['TCA']['tt_content']['columns']['pages']['config']['size'] = 10;
Put it in ext:your_ext/Configuration/TCA/Overrides/tt_content.php
alternative in ext:your_ext/ext_localconf.php
TYPO3 Reference to override TCA

TYPO3 V7.6, default value for Number of Columns

How is it possible to set in Page TSConfig the default value for "Number of Columns" in TYPO3 V7.6? In erlier versions it was possible with TCEFORM.tt_content.imagecols = 1. If I set in V7.6 TCEFORM.tt_content.imagecols = 1 it makes no different which value is set. There is always imagecols = 2 set.
I have PHP 7.0.7 and use the rendering extension fluid_styled_content (not css_styled_content). Is there something I am missing?
Thanks in advance for your help.
TCAdefaults.tt_content.imagecols = 1
works for me in TYPO3 7.6.11
TCEFORM.tt_content.imagecols.config.default = 1 is not working, as described op.
Be aware: This config never works if you switch content type after saving a content:
https://forge.typo3.org/issues/75233

Typo3: Use the Metadata from Hom Page

I'm using Typo3 and use the fields "metadata" on each page in order to specify the metadata.
I realize this with the following TypoScript code:
page.meta.keywords.field = keywords
page.meta.description.field = description
page.meta.robots= index, follow
Now I would like on the sides where no metadata is specified using the data from the home page. How can I realize the best?
You can make use of sliding content. This involves a little setup, but will make life alot easier for people maintaining the site.
You will need to add or alter the following line inside typo3conf/localconf.php
$TYPO3_CONF_VARS['FE']['addRootLineFields'] = ',description,keywords';
After that you can change your metadata like this:
page.meta.keywords.data = levelfield : -1 , keywords , slide
page.meta.description.data = levelfield : -1 , description , slide
Make sure to clear all cache. Then fill in the default values inside of the root-page (most of the times uid=1).
Now you can on any page override this setting, and it is automatically applied to all subpages of that page as well =)