For coders TYPO3 Tech Corner

[PHP] FlexForm einer Extension komplett ersetzen

[PHP] FlexForm einer Extension komplett ersetzen

ext_localconf.php eurer Extension (z.B. Sitepackage):

<?php defined('TYPO3_MODE') || die(); call_user_func( function () { /** * Overwrite FlexForm with a new one */ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'][] = \Vendor\YourSitepackage\Hooks\OverwriteFlexForm::class . '->overwrite'; } );

OverwriteFlexForm.php:

<?php declare(strict_types=1); namespace Vendor\YourSitepackage\Hooks; /** * Class OverwriteFlexForm */ class OverwriteFlexForm { /** * @var string */ protected $path = 'FILE:EXT:your_sitepackage/Configuration/FlexForms/FlexformStudyfinderList.xml'; /** * @return void */ public function overwrite() { $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['in2studyfinder_pi1,list'] = $this->path; } }

FlexformStudyfinderList.xml:

<T3DataStructure> <meta> <langDisable>1</langDisable> </meta> <sheets> <main> <ROOT> <TCEforms> <sheetTitle>LLL:EXT:in2studyfinder/Resources/Private/Language/locallang_db.xlf:listView</sheetTitle> </TCEforms> <type>array</type> <el> <settings.flexform.studyCourseDetailPage> <TCEforms> <exclude>1</exclude> <label>LLL:EXT:in2studyfinder/Resources/Private/Language/locallang_db.xlf:detailView</label> <config> <type>group</type> <internal_type>db</internal_type> <allowed>pages</allowed> <size>1</size> <maxitems>1</maxitems> <minitems>1</minitems> <show_thumbs>1</show_thumbs> <wizards> <suggest> <type>suggest</type> </suggest> </wizards> </config> </TCEforms> </settings.flexform.studyCourseDetailPage> <settings.flexform.select.department> <TCEforms> <label>LLL:EXT:in2studyfinder/Resources/Private/Language/locallang_db.xlf:department</label> <config> <type>select</type> <renderType>selectCheckBox</renderType> <maxitems>9999</maxitems> <size>5</size> <minitems>0</minitems> <foreign_table>tx_in2studyfinder_domain_model_department</foreign_table> <foreign_table_where>and tx_in2studyfinder_domain_model_department.sys_language_uid in (-1,0) order by tx_in2studyfinder_domain_model_department.title</foreign_table_where> </config> </TCEforms> </settings.flexform.select.department> <settings.flexform.select.graduation> <TCEforms> <label>LLL:EXT:in2studyfinder/Resources/Private/Language/locallang_db.xlf:academicDegree</label> <config> <type>select</type> <renderType>selectCheckBox</renderType> <maxitems>9999</maxitems> <size>5</size> <minitems>0</minitems> <foreign_table>tx_in2studyfinder_domain_model_graduation</foreign_table> <foreign_table_where>and tx_in2studyfinder_domain_model_graduation.sys_language_uid in (-1,0) order by tx_in2studyfinder_domain_model_graduation.title</foreign_table_where> </config> </TCEforms> </settings.flexform.select.graduation> <settings.flexform.bodytext> <TCEforms> <label>LLL:EXT:in2studyfinder_extend/Resources/Private/Language/locallang_db.xlf:flexform.bodytext</label> <config> <type>text</type> <default></default> <enableRichtext>1</enableRichtext> <richtextConfiguration>default</richtextConfiguration> </config> <defaultExtras>richtext[]:rte_transform[mode=ts_css]</defaultExtras> </TCEforms> </settings.flexform.bodytext> </el> </ROOT> </main> </sheets> </T3DataStructure>

Zurück

Kennst du das: Immer nur schnell schnell?

Wie wäre es einmal mit Zeit und Respekt für Codequalität? Arbeiten im Team? Automatisierte Tests?

Komm zu uns