get mergedProperties of sys_file_reference in tx_news - typo3

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}

Related

TYPO3 TCA: Add CSS class selection to inputLink

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.

how to extend the metadata in TYPO3 10.4.13

I am trying to add a description field under the page properties/metadata which was still present in the TYPO3 8.7.32 version.
I have also already tried in the setup with the following code:
page.meta.description.field = description
#page.meta.description.ifEmpty =
currently it looks like this
and should look like this
If your goal is to add a SEO description field, this field is already available in the SEO tab.
Nevertheless, if you want to add a new field in metadata, you have to :
Add the new field in : your_ext/ext_tables.sql
CREATE TABLE pages (
new_field varchar(255) DEFAULT '' NOT NULL
);
Override the TCA : create or update the file your_ext/Configuration/TCA/Overrides/pages.php
<?php
defined('TYPO3_MODE') or die();
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
call_user_func(static function () {
// Define new TCA field
$additionalFields = [
'new_field' => [
'exclude' => false,
'l10n_mode' => 'prefixLangTitle',
'label' => 'LLL:EXT:your_ext/Resources/Private/Language/locallang_db.xlf:pages.your_ext',
'description' => 'LLL:EXT:your_ext/Resources/Private/Language/locallang_db.xlf:pages.your_ext.description',
'config' => [
'type' => 'input',
'size' => 60,
'max' => 255
]
]
];
// Add the new TCA columns
ExtensionManagementUtility::addTCAcolumns('pages', $additionalFields);
// Add the field to the palette
ExtensionManagementUtility::addFieldsToPalette('pages', 'metatags', 'new_field', 'after:keywords');
});
Then you have to update the DB with BE module Maintenance > Analyze Database Structure.
Flush all cache - because TCA are in cache.
And your new field will now be available.

Typo3 10.4.1 extend pages with an file ref

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

How can we add new fields in a new tab in user setting in TYPO3

How can we add new fields in a new tab in user setting in TYPO3 version 8.7?
Our problem is the creation of a new tab.
I can add new fields to personal data tab in user setting, but I need to create new fields into a new tab.
For backend admin user setting I added a new tab, but for user setting I want to try this. I have an extension and since the installation of the extension it will add-on.
I tried to create new tab in fe_user.php.
Previously I tried to change ext_tables.php, but that is not working at all.
// Add some fields to FE Users table to show TCA fields definitions
// USAGE: TCA Reference > $GLOBALS['TCA'] array reference >
// ['columns'][fieldname]['config'] / TYPE: "select"
$temporaryColumns = array (
'tx_examples_options' => array (
'exclude' => 1,
'label' => 'tx_examples_options',
'config' => array (
'type' => 'select',
'showitem' => array (
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.0', '1'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.1', '2'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.2', '--div--'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.3', '3'),
),
'size' => 1,
'maxitems' => 1,
)
),
'tx_examples_special' => array (
'exclude' => 1,
'label' => 'tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'fe_users',
$temporaryColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'--div--;newtab,tx_examples_options, tx_examples_special'
);
When I changed into file ext_tables.php
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['copy_directory'] = array(
'label' => 'Alternative directory for saving copies',
'type' => 'text',
'table' => 'be_users',
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('copy_directory','after:lang');
then it's showing in "personal data" tab but I want new tab in user setting for non-admin user.
In general your code looks fine.
But you are in the wrong file!
Avoid ext_tables.php if possible.
If you change anything to the TCA you should do it in Configuration/TCA/ for new tables and Configuration/TCA/Overrides for enhancing existing tables.
Use filenames according to the table you are modifying.
In your case all the code should be located in Configuration/TCA/Overrides/fe_users.php.
And be sure you clear all caches if you develop anything with TCA!

TYPO3 - Extension TCA - Show backend fields

I'm deveopping my own Typo3 extension and it's not as easy as expected :)
When i create an object in the backend it's working :
But I can't find a way to display the following commands :
move up
move down
enable/disabled
Here is what I tried to show the "enable/disable" icon :
$TCA['tx_productsfaq_domain_model_scenario'] = array (
'ctrl' => array (
'enablecolumns' => [
'disabled' => 'hidden'
]
)
);
.. with no success. In my database the model has a "hidden" column (tinyint). Maybe I forgot something ? All other properties in my TCA work fine.
You need a sorting field in your Database
CREATE table tx_productsfaq_domain_model_scenario (
...
sorting int(11) DEFAULT '0' NOT NULL,
deleted tinyint(4) DEFAULT '0' NOT NULL,
hidden tinyint(4) DEFAULT '0' NOT NULL,
...
);
and TCA configuration like
$TCA['tx_productsfaq_domain_model_scenario'] = array (
'ctrl' => [
...
'sortby' => 'sorting',
'enablecolumns' => [
'disabled' => 'hidden'
],
...
]
);
It seems you are using the old way to configure your TCA. Please see https://docs.typo3.org/typo3cms/TCAReference/Introduction/Index.html
Use EXT:productsfaq/Configuration/TCA/tx_productsfaq_domain_model_scenario.php
return [
'ctrl' => [
...
'sortby' => 'sorting',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
],
...
],
'interface' => [
'showRecordFieldList' => 'hidden, ...'
],
'types' => [
'0' => ['showitem' => 'hidden, ...']
],
'columns' => [
...
]
];
Depending on your TYPO3 version move up, move down will be visible if you switch on extended view and have defined a sorting field (by default it is called sorting with type int).
To have the correct fields and options for sorting and hiding you may use the EXT:extension_builder and generate a dummy extension to identify these fields.
Compare your definition and declaration of the fields ('sorting', 'hidden') in TCA and SQL(!) to a build in table like tt_content.