We are using the Mask extension for some of our content Elements. (It basically adds dynamic CTypes and additional columns in the tt_content).
Next we have our custom extension whose entities should have a relation to an instance of a Mask module. Which works. The only problem is, that the labels of the inline element aren't showing up.
If we add the same Mask module as normal page content, the labels are showing up just fine.
Domain Model of our ext:
/**
* Returns the intro
*
* #return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MASK\Mask\Domain\Model\Content> $intro
*/
public function getIntro()
{
return $this->intro;
}
TCA
'intro' => [
'exclude' => 0,
'label' => 'Intro zentriert',
'config' => [
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'tx_zeppelinregions_content_elements',
'foreign_label' => 'tx_mask_teasergalleryheadline',
'foreign_table_field' => 'tx_zeppelinregions_content_elements_type',
'maxitems' => 1,
'foreign_match_fields' => [
'ctype' => 'mask_introzentriert',
],
'overrideChildTca' => [
'columns' => [
'CType' => [
'config' => [
'default' => 'mask_introzentriert',
'readOnly' => 1,
],
],
],
],
]
],
Missing labels in inline element:
(Note: the default tt_content field labels are showing)
Labels showing when adding an element of the same type as normal page content:
Related
I'm trying to add a CSS class selection in a TCA inputLink Field. I was able to create the selection in the RTE Editor and now I want to be able to select the same CSS classes in TCA link input fields.
Here is my current code:
'link' => [
'exclude' => 1,
'label' => 'foo label',
'config' => [
'type' => 'input',
'renderType' => 'inputLink',
'size' => 50,
'max' => 1024,
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => 'foo title',
'class' => [
'valuePicker' => [
'mode' => 'blank',
'items' => [
['button', 'Button Style'],
],
],
],
],
],
],
'softref' => 'typolink',
],
],
I couldn't find anything in the TCA Docs. I thought I would give it a try with the LinkPopup --> options --> class. But (as expected) nothing happens.
How am I able to define such a selection dropdown in the link input field?
I'm using TYPO3 LTS 11.
Not sure if you have configured, what you are describing...
A valuePicker can be placed next to an input field of RenderTypes default, colorpicker, inputLink (-> TCAref). The class field in the linkPopup is a simple (hardcoded) form field without a defined renderType or other TCA configuration (Code insight).
There are only a few options for configuring a linkpopup (-> TCAref):
pid
allowedExtensions
blindLinkFields
blindLinkOptions
Setting a prefilled (not selectable) class seems to be possible via TCAMAIN.linkHandler-options (-> LinkBrowser-API). I found an example in an issue of EXT:bootstrap_package.
hope a knowing being reads this.
The task is simple but something went wrong.
Ive wrote an extension to extend the pages table for every page with some new props.
These values are:
1 boolean value (is extension active)
1 Text value (e.g css class name)
1 Filelink to sys_file for uploaded images
The fields itself are working as expected in backend.
fields in backend
But if i try to access them via fluid in frontend, there is only a lony 1 (Int) saved?
In Fluid:
{data.tx_mnadditionalpagefields_extended_background_image}
leads to this -> 1 (Integer)
What iam doing wrong?
my ext_tables.sql
CREATE TABLE pages (
tx_mnadditionalpagefields_custom_css_class varchar(255) DEFAULT '' NOT NULL,
tx_mnadditionalpagefields_activate_extended_rules TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL,
tx_mnadditionalpagefields_extended_background_image int(11) unsigned NOT NULL default '0'
);
my ext.../Configuration/TCA/Overrides/pages.php
<?php
defined('TYPO3_MODE') or die();
// Configure new fields:
$fields = [
'tx_mnadditionalpagefields_custom_css_class' => [
'label' => 'LLL:EXT:nm_addtional_page_fields/Resources/Private/Language/locallang_db.xlf:pages.tx_mnadditionalpagefields_custom_css_class',
'exclude' => 1,
'config' => [
'type' => 'input',
'max' => 255
],
],
'tx_mnadditionalpagefields_activate_extended_rules' => [
'exclude' => 1,
'label' => 'LLL:EXT:nm_addtional_page_fields/Resources/Private/Language/locallang_db.xlf:pages.tx_mnadditionalpagefields_activate_extended_rules',
'config' => [
'type' => 'check',
'default' => 0
]
],
'tx_mnadditionalpagefields_extended_background_image' => [
'exclude' => 1,
'label' => 'LLL:EXT:nm_addtional_page_fields/Resources/Private/Language/locallang_db.xlf:pages.tx_mnadditionalpagefields_extended_background_image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_mnadditionalpagefields_extended_background_image',
[
'maxitems' => 1,
'minitems' => 0,
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
],
//'foreign_match_fields' => array(
// 'fieldname' => 'tx_mnadditionalpagefields_extended_background_image',
// 'tablenames' => 'pages',
// 'table_local' => 'sys_file',
//),
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
]
];
// Add new fields to pages:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $fields);
// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'pages', // Table name
'--palette--;LLL:EXT:nm_addtional_page_fields/Resources/Private/Language/locallang_db.xlf:pages.palette_title;nm_addtional_page_fields', // Field list to add
'1', // List of specific types to add the field list to. (If empty, all type entries are affected)
'after:nav_title' // Insert fields before (default) or after one, or replace a field
);
// Add the new palette:
$GLOBALS['TCA']['pages']['palettes']['nm_addtional_page_fields'] = [
'showitem' => 'tx_mnadditionalpagefields_activate_extended_rules,tx_mnadditionalpagefields_custom_css_class,tx_mnadditionalpagefields_extended_background_image'
];
Extension download (WIP): download
For images/files, the local table stores only the count of references to files. (int)1 means, there's one reference.
Have a look at DataProcessing for how to use these filereferences with Fluid:
https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/7.4/Feature-67662-DataProcessorForFiles.html
I want to format the title showing in a list of TCA items which can contain italic text. But whatever I try, I get only unformatted text - even from RTE text fields.
My base information is "partA", "partB", "partC" and I need a title like "partA : partC - part B"
My Code so far:
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:myext/Resources/Private/Language/myext.xlf:tx_myext_domain_model_myitem',
'label' => 'partC',
'label_alt' => 'partA',
'formattedLabel_userFunc' => T395\myExt\Classes\UserFuncs\MyBEUserFuncs::class.'->getFullMyitemTitle',
'formattedLabel_userFunc_options' => [
'sys_file' => [
'partC','partA','partB'
]
],
'iconfile' => 'fileadmin/Resource/icons/svgs/myext.svg',
],
'columns' => [
'partC' => [
'label' => 'LLL:EXT:myext/Resources/Private/Language/myext.xlf:tx_myext_domain_model_myitem.partC',
'config' => [
'type' => 'text',
'enableRichtext' => true,
],
],
'partA' => [
'label' => 'LLL:EXT:myext/Resources/Private/Language/myext.xlf:tx_myext_domain_model_myitem.partA',
'config' => [
'type' => 'input',
'size' => '5',
'eval' => 'trim',
],
],
'partB' => [
'label' => 'LLL:EXT:myext/Resources/Private/Language/myext.xlf:tx_myext_domain_model_myitem.partC',
'config' => [
'type' => 'input',
'size' => '5',
'eval' => 'trim',
],
],
],
'types' => [
'0' => ['showitem' => 'partA,partB,partC'],
],
];
And the UF:
<?php
T395\myExt\Classes\UserFuncs;
class MyBEUserFuncs
{
public function getFullMyitemTitle(&$params, &$pObj)
{
echo "Hello World!";
$params['title'] = $params['row']['partA'].' : '.$params['row']['partC'].' - '.$params['row']['partB'];
}
}
Even the echo is not showing. Changing the formattedLabel_userFunc to label_userFunc results in getting a string in right order - but right without any text formats like <i> etc but showing them as text. I'm sure, I'm missing something, but I can't figure out what it is - I was also unable to find any code snippets or examples showing the right way - and the docs from TYPO3 saying only that exists formattedLabel_userFunc and it has options - but no proper example there. Hope you can help me. Thank you!
in the documentation for formattedlabel_userfunc you can find:
[...] return formatted HTML for the label and used only for the labels of inline (IRRE) records.
and for label_userfunc there is the warning:
The title is passed later on through htmlspecialchars() so it may not include any HTML formatting.
Links to files or images in fields which use the renderType inputLink (e.g header_link in the normal content elements) do not update the reference index when the content element is saved.
My TCA:
'config' => [
'type' => 'input',
'renderType' => 'inputLink',
'size' => 50,
'max' => 1024,
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => '',
],
],
],
'softref' => 'typolink'
(the same as in header_link in the content elements)
Is there a possibility to force the correct handling of the reference index? The editors can't see which files are linked and which not, so they can delete the files in file module without error message.
Thanks
this bug was fixed with TYPO3 9.7.12:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/62205
I would like to set a checkbox in the backend to default checked.
In my case it is the field showinpreview in the file /typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php.
I changed the value default to 1, but it has no effect:
'showinpreview' => [
'exclude' => 1,
'label' => $ll . 'tx_news_domain_model_media.showinpreview',
'config' => [
'type' => 'check',
'default' => 1
]
],
When I check the TCA File of tt_content for a checked checkbox it looks like this:
'sectionIndex' => [
'exclude' => 1,
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex',
'config' => [
'type' => 'check',
'default' => 1,
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
]
]
],
The only difference I see is the items. But I do not really understand what this item-value does.
The easiest way to change this value is by overriding TCA with some pageTS. Add following to the pagets of the folder that holds the news records.
TCAdefaults.sys_file_reference.showinpreview = 1
See https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/TCEform/Index.html
For the older EXT:news versions use: TCAdefaults.tx_news_domain_model_media.showinpreview = 1
The value of the field showinpreview is set in news/Configuration/TCA/Overrides/sys_file_reference.php. Apply your change there, and you will be happy.
But be aware: after updating of the news extension your change will be lost.
Just checked - this works for me
'checkbox' => array(
'exclude' => 0,
'label' => 'My Label',
'config' => array(
'type' => 'check',
'default' => '1'
)
),