Problem / Motivation
The plugin FlexForm field settings.flexform.selectCategory (Configuration/FlexForm/Flexform.xml) currently lists all category records (tx_jpfaq_domain_model_category) of the entire installation:
<config>
<type>select</type>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_jpfaq_domain_model_category</foreign_table>
<foreign_table_where>ORDER BY category</foreign_table_where>
...
</config>
This is problematic in multi-site / multi-domain installations:
- Categories cannot be scoped per site or page tree. Editors working on site A see (and can select) the FAQ categories of site B and C as well. With several sites or several independent FAQ trees within one site, the select box becomes cluttered and error-prone.
- All localizations are listed as separate entries. FormEngine does not filter
foreign_table selects by language, so every translated category record shows up alongside its default-language original, further bloating the list.
Proposed solution
Enhance the foreign_table_where of settings.flexform.selectCategory so that integrators can optionally restrict the selectable categories via Page TSconfig, and so that the list is filtered by the language of the content element:
<foreign_table_where>
AND (0 IN (###PAGE_TSCONFIG_IDLIST###) OR {#tx_jpfaq_domain_model_category}.{#pid} IN (###PAGE_TSCONFIG_IDLIST###))
AND {#tx_jpfaq_domain_model_category}.{#sys_language_uid} IN (-1, ###REC_FIELD_sys_language_uid###)
ORDER BY category
</foreign_table_where>
How the PID restriction works (opt-in via Page TSconfig)
TCEFORM.tt_content.pi_flexform.jpfaq_faq.main.settings\.flexform\.selectCategory.PAGE_TSCONFIG_IDLIST = 42,43
| Page TSconfig |
Resulting behavior |
| (not set) |
Marker defaults to 0, so 0 IN (0) matches → all categories are listed (current behavior, fully backwards compatible) |
PAGE_TSCONFIG_IDLIST = 42,43 |
Only categories stored on pid 42 or 43 are listed |
PAGE_TSCONFIG_IDLIST = 0 |
Explicitly resets to "all" (useful to undo an inherited restriction within a sub tree) |
Since Page TSconfig is inherited down the page tree, this supports per-site defaults and per-branch overrides — e.g. several independent FAQ trees within a single site, each with its own category storage folder.
How the language filter works
###REC_FIELD_sys_language_uid### resolves to the language of the content element the plugin lives in (in FlexForm context, FormEngine reads the marker value from flexParentDatabaseRow.
- Plugin in default language →
sys_language_uid IN (-1, 0): default-language categories plus "all languages" records
- Translated plugin (e.g.
sys_language_uid = 1) → sys_language_uid IN (-1, 1): only categories translated into that language
Backwards compatibility
- The PID restriction is fully opt-in: without any Page TSconfig the list stays unrestricted, exactly as today.
- The language condition does change current behavior insofar as localized category records are no longer offered for default-language plugins (and vice versa). Arguably the current behavior — mixing all languages in one list — is more of a bug than a feature.
Problem / Motivation
The plugin FlexForm field
settings.flexform.selectCategory(Configuration/FlexForm/Flexform.xml) currently lists all category records (tx_jpfaq_domain_model_category) of the entire installation:This is problematic in multi-site / multi-domain installations:
foreign_tableselects by language, so every translated category record shows up alongside its default-language original, further bloating the list.Proposed solution
Enhance the
foreign_table_whereofsettings.flexform.selectCategoryso that integrators can optionally restrict the selectable categories via Page TSconfig, and so that the list is filtered by the language of the content element:How the PID restriction works (opt-in via Page TSconfig)
0, so0 IN (0)matches → all categories are listed (current behavior, fully backwards compatible)PAGE_TSCONFIG_IDLIST = 42,43PAGE_TSCONFIG_IDLIST = 0Since Page TSconfig is inherited down the page tree, this supports per-site defaults and per-branch overrides — e.g. several independent FAQ trees within a single site, each with its own category storage folder.
How the language filter works
###REC_FIELD_sys_language_uid###resolves to the language of the content element the plugin lives in (in FlexForm context, FormEngine reads the marker value fromflexParentDatabaseRow.sys_language_uid IN (-1, 0): default-language categories plus "all languages" recordssys_language_uid = 1) →sys_language_uid IN (-1, 1): only categories translated into that languageBackwards compatibility