flux icon indicating copy to clipboard operation
flux copied to clipboard

Cannot target specific form fields with PageTSconfig

Open tpinne opened this issue 3 years ago • 1 comments

I try to modify a flux form field via PageTSconfig. For example I want to modify the list of a select field. Given an extension name of imos_base, the following form configuration

<f:section name="Configuration">
    <flux:form id="teaser">
      <flux:field.select name="displayMode" items="a,b,c" />
      <!-- more fields ... -->
    </flux:form>
</flux:section>

and the TYPO3 docs suggesting a TSConfig path like TCEFORM.tt_content.pi_flexform.my_ext_pi1.sDEF.myField.removeItems

I tried several combinations without any success.

TCEFORM.tt_content.pi_flexform.imosbase_teaser.options.displayMode.removeItems = b
TCEFORM.tt_content.pi_flexform.tx_flux.options.displayMode.removeItems = b
TCEFORM.tt_content.pi_flexform.options.displayMode.removeItems = b
TCEFORM.tt_content.pi_flexform.data.options.displayMode.removeItems = b
TCEFORM.tt_content.pi_flexform.imosbase_teaser.data.options.displayMode.removeItems = b
TCEFORM.tt_content.pi_flexform.tx_flux.data.options.displayMode.removeItems = b

I also tried replacing options with sDEF as a last just-in-case resort.

I tried to disable other simple input fields to get the targeting right but can't find any combination to modify those fields. Am I missing something obvious or is it just not possible with flux?

TYPO3 9.5 flux 9.2.0

Best regards Tobi

tpinne avatar Oct 19 '20 15:10 tpinne

Eureka.

Given this flux content "Mycontent.html", provided by an extension "site" :

<f:section name="Configuration">
    <flux:form>
	<flux:field.relation name="event"
     				table="tx_site_domain_model_events"
				condition="AND tx_site_domain_model_events.pid = ###PAGE_TSCONFIG_ID###" />
    </flux:form>
</f:section>

The CType of the flux content is site_mycontent.

I can target the field "event" with that line:

TCEFORM.tt_content.pi_flexform.types.site_mycontent.default.options.event.PAGE_TSCONFIG_ID = 42

For me, the missing part was the datastructure name : default. I found it debugging that method \TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexProcess::getPageTsOfFlex.

dogawaf avatar Jul 08 '22 14:07 dogawaf

Thanks for the solution and investigation, @dogawaf - closing the issue as solved.

NamelessCoder avatar Nov 07 '22 14:11 NamelessCoder