Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<flux:field.multiRelation> autocomplete breaks when fluidcontent element not saved yet #1272

Closed
cweiske opened this issue Jan 6, 2017 · 5 comments

Comments

@cweiske
Copy link
Contributor

cweiske commented Jan 6, 2017

I've got a fluidcontent element with a <flux:field.multiRelation> field.

Entering letters in its autocomplete field sends an AJAX request to the server, and this one throws an HTTP 500 error because of an exception:

#1: PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/site/htdocs/typo3conf/ext/fluidcontent/Classes/Provider/ContentProvider.php line 203

The exception only occurs when the content element has not been saved yet. Once it has been saved, autocompletion works fine.

This happens with fluidcontent 4.4.1 and flux 7.4.0.

Code:

<flux:field.multiRelation name="settings.entries" table="tx_example" minItems="1" maxItems="1000">
    <flux:wizard.suggest/>
</flux:field.multiRelation>

Exception trace:

19 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "explode() expects parameter 2 to be string, array given", "/var/www/site/htdocs/typo3conf/ext/fluidcontent/Classes/Provider/ContentProvider.php", 203, array)
18 explode(":", array)
17 FluidTYPO3\Fluidcontent\Provider\ContentProvider::getControllerExtensionKeyFromRecord(array)
16 FluidTYPO3\Flux\Provider\AbstractProvider::getControllerPackageNameFromRecord(array)
15 FluidTYPO3\Flux\Provider\AbstractProvider::resolveFormClassName(array)
14 FluidTYPO3\Flux\Provider\AbstractProvider::getForm(array)
13 FluidTYPO3\Fluidcontent\Provider\ContentProvider::getForm(array)
12 FluidTYPO3\Flux\Provider\AbstractProvider::postProcessDataStructure(array, array, array)
11 FluidTYPO3\Flux\Backend\DynamicFlexForm::getFlexFormDS_postProcessDS(array, array, array, "tt_content", "pi_flexform")
10 TYPO3\CMS\Backend\Utility\BackendUtility::getFlexFormDS(array, array, "tt_content", "pi_flexform")
9 TYPO3\CMS\Backend\Form\Wizard\SuggestWizard::overrideFieldNameAndConfigurationForFlexform("tt_content", "pi_flexform|data|options|lDEF|settings.entries|vDEF", array, NULL)
8 TYPO3\CMS\Backend\Form\Wizard\SuggestWizard::searchAction(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)
@NamelessCoder
Copy link
Member

This is, unfortunately, a TYPO3 core bug. The only course of action we in FluidTYPO3 can take, is to hide the FlexForm field from view until the record is saved at least once. The source of the problem is the rewritten FormEngine which no longer provides a full or partial record (full if saved, partial with default values if not saved) to the hooks which resolve the DS. Because this vital variable is no longer transmitted to hooks, Flux becomes incapable of resolving the correct DS based on CType or other parameters of the not-yet-saved record.

It's not a pretty situation but there's really not much we can do about it - other than preventing such things by not presenting the field until the DS can consistently be resolved.

@cweiske
Copy link
Contributor Author

cweiske commented Jan 24, 2017

I've opened a bug report for TYPO3 core: Bug #79434: Hooks do not get full or partial record from FormEngine

@NamelessCoder
Copy link
Member

The overall bug here is now solved - and we can produce DS also for new records! - but it may come with some assembly required, depending on your setup.

If your Provider or template from which the Flux form is extracted (via the Provider) depends on fields from the record which are NOT present in $GLOBALS['TCA']['tt_content']['ctrl']['useColumnsForDefaultValues'] you will need to add the field names that you require, to this list, using TCA overrides.

@cweiske
Copy link
Contributor Author

cweiske commented Feb 12, 2017

Could you please point me to a commit where this is solved? The TYPO3 bug I opened is still open.

@NamelessCoder
Copy link
Member

c0e01b6 solved it from the Flux side - seems we now receive enough data to compile a DS, and we started passing this (limited) data in XHR requests.

Not sure if you can close the core issue... but it looks like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants