sys_categories FAL image editor - typo3

I need to activate the "Image editor" for TYPO3 (8.7) sys_categories. In every other Element which uses FAL the editor is available. Only in the Category Images I did not have this option.
How do I active it?
I've tried to set the exact same TCA to this field but no changes.
Here is the TCA (of the tx_news) Extension:
'images' => [
'exclude' => true,
'l10n_mode' => 'mergeIfNotBlank',
'label' => $ll . 'tx_news_domain_model_category.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference',
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true
],
'foreign_match_fields' => [
'fieldname' => 'images',
'tablenames' => 'sys_category',
'table_local' => 'sys_file',
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
)
]
Also this file on GitHub: https://github.com/georgringer/news/blob/master/Configuration/TCA/Overrides/sys_category.php

You might compare your TCA with the configuration for field assets in record tt_content.
As the cropping is stored in sys_file_reference I would have a closer look to the showitem value "imageoverlayPalette"

Answer
The config index "foreign_types" were missing. Override the TCA settings like this and it works:
<?php
defined('TYPO3_MODE') or die();
$ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:';
$newSysCategoryColumns = [
'images' => [
'exclude' => true,
'label' => $ll . 'tx_news_domain_model_category.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images',
[
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference',
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'showAllLocalizationLink' => true,
'showSynchronizationLink' => true
],
'foreign_match_fields' => [
'fieldname' => 'images',
'tablenames' => 'sys_category',
'table_local' => 'sys_file',
],
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
)
),
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
)
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_category', $newSysCategoryColumns);

Related

TYPO3 custom content inline elements

Is it possible to create a custom content element (type inline) where i can choose from the default typo3 elements (text with image, grids, html)?
At the moment i have an custom content with a new table an can insert my own element as a child.
I would like to give the editor the opprtunity to create an element like an tag and insert whatever he wants.
i have this code
'parent_uid' => [
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
[
'',
0,
],
],
'default' => 0,
'foreign_table' => 'tt_content',
'foreign_table_where' => 'AND tt_content.pid=###CURRENT_PID### AND tt_content.sys_language_uid IN (-1, ###REC_FIELD_sys_language_uid###)',
],
],
'parent_table' => [
'config' => [
'type' => 'passthrough',
],
],
and this
$tabs = [
'k_custom_content_tab' => [
'exclude' => true,
'label' => 'Field label',
'config' => [
'appearance' => [
'collapseAll' => '1',
'enabledControls' => [
'dragdrop' => '1',
],
'levelLinksPosition' => 'bottom',
'useSortable' => '1',
],
'foreign_field' => 'parent_uid',
'foreign_table' => 'k_custom_content_tab',
'foreign_table_field' => 'parent_table',
'maxitems' => '20',
'minitems' => '1',
'type' => 'inline',
],
],
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tt_content',
$tabs
);

TYPO3 FAL Label for Edit Form

I wrote an extension for a slider. It all works well. My last problem is this: If I add an image in the list view, then the label appears with the HTML tags above. How can I customize the label or remove the tags?
'image' => [
'exclude' => true,
'label' => 'LLL:EXT:abc_slider/Resources/Private/Language/locallang_db.xlf:tx_abcslider_domain_model_slider.image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'maxitems' => 1
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
Do i need something like this? foreign_match_fields

Extending tt_content with inline element, element is not attached

I created an extension in TYPO3 9.5 for adding multiple elements from another table to tt_content with type "inline" (IRRE) according to the tutorial.
I can add new inline elements to a content element in backend but as I am saving them, they are not attached to the tt_content element. But I can see them as records in the list view. Only the connection between the two elements are missing.
The definition of the additional field for tt_content:
CREATE TABLE tt_content (
tx_jrinterview_question_answer int(11) DEFAULT '0' NOT NULL
);
The definition of the new records table:
CREATE TABLE tx_jrinterview_question_answer (
parentid int(11) DEFAULT '0' NOT NULL,
parenttable varchar(255) DEFAULT '' NOT NULL,
question varchar(255) DEFAULT '' NOT NULL,
answer text
);
The TCA part for tt_content to add the IRRE functionality:
'tx_jrinterview_question_answer' => [
'exclude' => true,
'label' => 'Questions and Answers',
'config' => [
'type' => 'inline',
'allowed' => 'tx_jrinterview_question_answer',
'foreign_table' => 'tx_jrinterview_question_answer',
'foreign_field' => 'parentid',
'foreign_table_field' => 'parenttable',
'minitems' => 0,
'maxitems' => 99,
],
],
],
And the TCA for the new record:
<?php
return [
'ctrl' => [
'title' => 'Question and answer',
'label' => 'question',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'versioningWS' => true,
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'question,answer',
],
'interface' => [
'showRecordFieldList' => 'parentid,parenttable,sys_language_uid, l10n_parent, l10n_diffsource, hidden, question, answer',
],
'types' => [
'0' => ['showitem' => 'parentid, parenttable, sys_language_uid, l10n_parent, l10n_diffsource, hidden, question, answer, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'],
],
'columns' => [
'pid' => [
'label' => 'Pid',
'config' => [
'type' => 'passthrough'
]
],
'crdate' => [
'label' => 'Crdate',
'config' => [
'type' => 'passthrough',
]
],
'tstamp' => [
'label' => 'Tstamp',
'config' => [
'type' => 'passthrough',
]
],
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
]
],
'default' => 0,
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'default' => 0,
'items' => [
['', 0],
],
'foreign_table' => 'tx_jrinterview_question_answer',
'foreign_table_where' => 'AND tx_jrinterview_question_answer.pid=###CURRENT_PID### AND tx_jrinterview_question_answer.sys_language_uid IN (-1,0)',
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
],
],
'hidden' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
],
],
],
'starttime' => [
'exclude' => true,
'behaviour' => [
'allowLanguageSynchronization' => true
],
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'size' => 13,
'eval' => 'datetime',
'default' => 0,
],
],
'endtime' => [
'exclude' => true,
'behaviour' => [
'allowLanguageSynchronization' => true
],
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'size' => 13,
'eval' => 'datetime',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
],
],
],
'parentid' => [
'exclude' => true,
'label' => 'parentid',
'config' => [
'type' => 'passthrough',
],
],
'parenttable' => [
'exclude' => true,
'label' => 'parenttable',
'config' => [
'type' => 'passthrough',
],
],
'question' => [
'exclude' => true,
'label' => 'question',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim'
],
],
'answer' => [
'exclude' => true,
'label' => 'answer',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim'
]
],
],
];
Perhaps this has to be something with the language? If I change in the table directly the parentid and parenttable after creating it via IRRE, the record is shown.
Add more fields to your question/answer table.
In your ext_tables.sql
CREATE TABLE tx_jrinterview_question_answer (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
crdate int(11) DEFAULT '0' NOT NULL,
cruser_id int(11) DEFAULT '0' NOT NULL,
deleted tinyint(4) DEFAULT '0' NOT NULL,
hidden tinyint(4) DEFAULT '0' NOT NULL,
parentid int(11) DEFAULT '0' NOT NULL,
parenttable varchar(255) DEFAULT '' NOT NULL,
question varchar(255) DEFAULT '' NOT NULL,
answer text,
PRIMARY KEY (uid),
KEY parent (pid)
);
In your Configuration/TCA/tx_jrinterview_question_answer.php
<?php
defined('TYPO3_MODE') or die();
return [
'ctrl' => [
'title' => 'tx_jrinterview_question_answer',
'label' => 'question',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
],
],
'interface' => [
'showRecordFieldList' => 'parentid,parenttable,question,answer'
],
'columns' => [
'pid' => [
'label' => 'Pid',
'config' => [
'type' => 'passthrough'
]
],
'crdate' => [
'label' => 'Crdate',
'config' => [
'type' => 'passthrough',
]
],
'tstamp' => [
'label' => 'Tstamp',
'config' => [
'type' => 'passthrough',
]
],
'hidden' => [
'exclude' => true,
'label' => 'Hidden',
'config' => [
'type' => 'check',
'default' => 0
]
],
'parentid' => [
'exclude' => true,
'label' => 'Parentid',
'config' => [
'type' => 'passthrough',
],
],
'parenttable' => [
'exclude' => true,
'label' => 'Parenttable',
'config' => [
'type' => 'passthrough',
],
],
'question' => [
'exclude' => true,
'label' => 'Question',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim'
],
],
'answer' => [
'exclude' => true,
'label' => 'Answer',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 15,
'eval' => 'trim'
]
],
],
'types' => [
0 => [
'showitem' => 'parentid,parenttable,question,answer'
]
]
];
And the connection should be keept. I did test it.

TYPO3 File Reference delete file and reference

How to delete the file and the file reference from this model?
I mean by code in controller. As far as I know there is no method to delete files.
The according TCA:
'backgroundimage' => array(
'label' => 'LLL:EXT:feusersplus/Resources/Private/Language/locallang_db.xlf:tx_feusersplus_domain_model_user.backgroundimage',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
),
'maxitems' => 1,
'foreign_match_fields' => array(
'fieldname' => 'backgroundimage',
'tablenames' => 'fe_users',
'table_local' => 'sys_file',
),
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
)
)
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
),
),
The according Model:
/**
* backgroundimage
*
* #var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $backgroundimage = null;
I am using TYPO3 7.6.18
Thank you in advance
If you remove the file $file->getStorage()->deleteFile($file); the fileReference gets deleted automatically

Typo3 FAL missing alternative text field in Extension

i am using FAL in my Extension and cant get the alternative field showing.
Please look at these 2 images to have a better view:
Image 1: This is the view in my extension
Image 2: This view is in Typo3 Page Ressource Tab
As you can see the image is working fine, so its not this problem: TYPO3 fal upload image with alt-text.
Here is my TCA code:
'images' => array(
'exclude' => 1,
'label' => 'LLL:EXT:fy_reference/Resources/Private/Language/locallang_db.xlf:tx_fyreference_domain_model_reference.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
),
'minitems' => 0,
'maxitems' => 9999,
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
'files' => array(
'exclude' => 1,
'label' => 'Files',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('files', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
),
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
),
),
Any advise will be thankful.
Found the solution thanks to: TYPO3 FAL: enable Alt text and Link for custom domain field and https://forge.typo3.org/issues/56884
It seems that I have overread the answere.
Here is the complete TCA:
'images' => array(
'exclude' => 1,
'label' => 'LLL:EXT:fy_reference/Resources/Private/Language/locallang_db.xlf:tx_fyreference_domain_model_reference.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', array(
'foreign_selector_fieldTcaOverride' => array(
'config' => array(
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => 'gif,jpg,jpeg,tif,tiff,bmp,png'
)
)
),
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
),
'minitems' => 0,
'maxitems' => 9999,
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
)
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
'files' => array(
'exclude' => 1,
'label' => 'Files',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('files', array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
),
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
),
),
Important is to add these line:
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
)
If you also want to limit the upload files type, you could use this:
'foreign_selector_fieldTcaOverride' => array(
'config' => array(
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => 'gif,jpg,jpeg,tif,tiff,bmp,png'
)
)
),
You will get this: