Skip to content

Instantly share code, notes, and snippets.

@einpraegsam
Last active June 30, 2023 14:59
Show Gist options
  • Save einpraegsam/c16ba695a5e3d903c2a2f795d98bca71 to your computer and use it in GitHub Desktop.
Save einpraegsam/c16ba695a5e3d903c2a2f795d98bca71 to your computer and use it in GitHub Desktop.
Overwrite a FlexForm from any Extension with your FlexForm in TYPO3
<?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'][] =
\In2code\In2studyfinderExtend\Hooks\OverwriteFlexForm::class . '->overwrite';
}
);
<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>
<?php
declare(strict_types=1);
namespace In2code\In2studyfinderExtend\Hooks;
/**
* Class OverwriteFlexForm
*/
class OverwriteFlexForm
{
/**
* @var string
*/
protected $path = 'FILE:EXT:in2studyfinder_extend/Configuration/FlexForms/FlexformStudyfinderList.xml';
/**
* @return void
*/
public function overwrite()
{
$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['in2studyfinder_pi1,list']
= $this->path;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment