I do not manage to set the text fields in tx_news required.
If i try:
TCEFORM.tx_news_domain_model_news.teaser.config.eval = required
this doesn't work.
Anybody an idea?
IMO this can't work currently as eval is not one of the fields which are overrideable. Those are defined in FormEngineUtility with
protected static $allowOverrideMatrix = [
'input' => ['size', 'max', 'readOnly'],
'text' => ['cols', 'rows', 'wrap', 'max', 'readOnly'],
'check' => ['cols', 'readOnly'],
'select' => ['size', 'autoSizeMax', 'maxitems', 'minitems', 'readOnly', 'treeConfig'],
'group' => ['size', 'autoSizeMax', 'max_size', 'maxitems', 'minitems', 'readOnly'],
'inline' => ['appearance', 'behaviour', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label', 'readOnly'],
'imageManipulation' => ['ratios', 'cropVariants']
];
Solutions are:
Override it in TCA with a custom extension
Create a custom formprovider and set it there
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.
I am using TYPO3 9.5.26 with tx_news 8.5.2. I have extended sys_file_reference with my own field. I can access this fields value in my fluid templates like so:
{file.properties.tx_myext_frame}
This is tested and works fine. However in the news module this stays empty
{mediaElement.properties.tx_myext_frame}
How can I use the orginalFile properties in tx_news?
Thanks
Code I use to add the field:
typo3conf\ext\myext\ext_tables.sql
CREATE TABLE sys_file_reference (
tx_myext_frame tinyint(4) DEFAULT '0' NOT NULL,
);
typo3conf\ext\myext\Configuration\TCA\Overrides\sys_file_reference.php
// Add some fields to sys_file_reference table
$temporaryColumns = [
'tx_myext_frame' => [
'exclude' => 0,
'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:tx_myext_frame',
'config' => [
'type' => 'check',
'default' => '0',
]
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'sys_file_reference',
'imageoverlayPalette',
'--linebreak--,tx_myext_invert,tx_myext_frame',
'after:description'
);
found the answer myself just now - so for anyone trying this use
{mediaElement.originalResource.properties.tx_myext_frame}
I've been searching for quite a while but couldn't find what I was looking for.
I've created two custom content-elements: parallax_content and bg_image.
In the backend for the time being I have the fields of a standard textmedia-element the code for which is as follows (from tt_content):
array('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.header;
header,
rowDescription,
bodytext;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel,
--div--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.media,
assets,
--palette--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.imagelinks;
imagelinks,
--div--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
layout;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:layout_formlabel,
--palette--;
LLL:EXT:fluid_styled_content/Resources/Private/Language/Database.xlf:tt_content.palette.mediaAdjustments;mediaAdjustments,
--palette--;
LLL:EXT:fluid_styled_content/Resources/Private/Language/Database.xlf:tt_content.palette.gallerySettings;
gallerySettings,
--palette--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,
--div--;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
hidden;
LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:field.default.hidden,
--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',
'columnsOverrides' => array(
'bodytext' => array(
'defaultExtras' => 'richtext:rte_transform[mode=ts_css]'
)
)
)
For my element parallax_content I would need the following fields:
Header
a checkbox "insert Logo"
a bodytext
an image selecting field
For image_bg I would need:
an image selecting field
a dropdown list with 2 items
But I'm struggling with understanding the code and how I would neet to adapt it so it would work. I've looked at the documentation but it doesn't really answer my question as it only shows one example of code with some lines but no explanation. I couldn't find the other documentation again where I gained just as "much" information as in the one linked above. I do understand some parts, for example the palette.header creates the whole header palette with header, header-link, alignment, date etc.
So my questions are:
Can someone explain to me how the code above works exaclty? Where does one element start and where does it end? what do "--palette--" and "--div--" do? how are the tabs created (e.g. general, media etc)? Is it possible to create my fields as listed above with these palettes? Can I create my own palette? If yes how? Or is there maybe a typoscript I can use/make to create my custom fields? Or would I need to create an extension for each of these elements? If possible I'd like to avoid this.
Yes, it's quite a lot of questions, I'm a novice in TYPO3 and not only trying to work with TYPO3 but also understand it as far as possible (at least for the things I need). My utmost priority is to understand the code above, but any pointers, explanations, help or even links to documentations (which I might not have seen so far) which could lead to a solution for my request I would greatly appreciate. Thanks in advance!
in my current project I added a parallax effect to the textmedia element in the tt_content.
First I override the tt_content TCA:
'background_media' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:extension/Resources/Private/Language/locallang.xml:background_media',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'background_media',
array(
'minitems' => 0,
'maxitems' => 1,
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:extension/Resources/Private/Language/locallang.xml:add_media',
'showAllLocalizationLink' => 1,
),
'foreign_match_fields' => array(
'fieldname' => 'background_media',
'tablenames' => 'tt_content',
'table_local' => 'sys_file',
),
// custom configuration for displaying fields in the overlay/reference table
// to use the newsPalette and imageoverlayPalette instead of the basicoverlayPalette
'foreign_types' => array(
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette,
--palette--;;imageoverlayPalette,
--palette--;;filePalette'
),
)
),
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
)
),
'effects' => [
'exclude' => true,
'label' => 'LLL:EXT:extension/Resources/Private/Language/locallang.xml:effects',
'config' => [
'type' => 'select',
'itemsProcFunc' => 'VENDOR\Extension\UserFunction\ProviderField->createEffectItems',
'renderType' => 'selectCheckBox',
'multiple' => true,
'minitems' => 0,
'maxitems' => 999,
'items' => []
]
],...
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'background_media,effects', 'textmedia', 'after:layout');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'image_classes,text_classes', 'textmedia', 'after:layout');
Now I have 2 additional fields:
- Background Image (FAL)
- Selct Box (UserFunc) for own styles
My UserFunc (VENDOR\Extension\UserFunction\ProviderField->createEffectItems)
/**
* #param ConfigurationService $configurationService
* #return void
*/
public function injectConfigurationService(ConfigurationService $configurationService) {
$this->configurationService = $configurationService;
}
public function createEffectItems($config) {
$settings = $this->configurationService->getSettingsForExtensionName('extension');
$classNames = json_decode($settings['container']['effects'],true);
if (!is_array($classNames)) return $config;
$optionList = array();
foreach ($classNames as $key => $val) {
$optionList[] = [$val, $key];
}
$config['items'] = array_merge($config['items'], $optionList);
return $config;
}
Now I can define my own CSS classes in Typoscript setting...
Last but not least the FluidStyleContent Part:
I overrride the Fluid_tyled_content template Textmedia.html and Layout Detaulf.html.
<v:content.resources.fal uid="{data.uid}" table="tt_content" field="background_media" as="ceBackground">
<f:if condition="{ceBackground}">
{v:uri.image(treatIdAsReference: 1, src: ceBackground.0.id, maxW: 1920) -> v:variable.set(name: 'parallaxBg')}
</f:if>
</v:content.resources.fal>
<div id="c{data.uid}" {f:if(condition: '{parallaxBg}', then: 'style="background-image: url(\'{parallaxBg}\');" ')}">
</div>
For a multiple classes use: {data.effects -> v:format.replace(substring: ',', replacement: ' ')}
Best regards
So i have a custom enum which has a function as data provider:
$dictionary['Opportunity']['fields']['custom_enum_c'] = array(
'labelValue' => 'Enum',
'name' => 'custom_enum_c',
'inline_edit' => '1',
'vname' => 'LBL_CUSTOM_ENUM',
'type' => 'enum',
'function' => 'getAccounts',
'len' => '255',
'comment' => 'Enum',
'default_value' => '',
);
How is this field saved in fields_meta_data? Specifically where is the function saved in the fields_meta_data table? In one of the ext fields?
Thanks in advance!
As you can see that there is no option in studio to enter "function" there. You can only set it via code. Either by creating new field in custom/Extension/modules//Ext/Vardef OR you can override exciting one as well. Let me know if you face any issue while exploring it.
I'd like to have 3 separate texts for each field in my form as a label. They are separate, because they need to be styled differently. I tried this:
$builder->add('total_sales', 'text', array(
'label' => array('num' => '1', 'descr' => 'Total sales', 'category' => 'A'),
'required' => false,
'attr' => array(
'class' => 'field numeric_field',
'maxlength' => 10,
)));
Obviously the above don't work; it will display 'Array' in place of label.
How can I achieve desired effect?
first you'll need to create a custom form type that extends the text type, the reason for this is so you don't mess up other text types you might have elsewhere. After doing that you'll need to style it using a form_div_layout. you can see the details here:
http://symfony.com/doc/current/cookbook/form/form_customization.html