Project

General

Profile

Actions

Feature #75652

closed

User-Elements cannot add RequireJS-Modules

Added by Robert Vock about 8 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2016-04-15
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Currently TCA UserElements cannot add JavaScript to the resultArray of TYPO3\CMS\Backend\Form\AbstractNode. They can only manipulate the HTML:
https://github.com/TYPO3/TYPO3.CMS/blob/b63420e/typo3/sysext/backend/Classes/Form/Element/UserElement.php#L39

Of course it is possible to add the RequireJS-Modules directly:
GeneralUtility::makeInstance(PageRenderer::class)->loadRequireJsModule('TYPO3/CMS/EXTENSION/JS_MODULE');

But this does not work in inline-elements. The FormInlineAjaxController only checks the data in the result-array and adds it to the Ajax-Response:
https://github.com/TYPO3/TYPO3.CMS/blob/b63420e/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php#L658

An easy fix would be to add the resultArray as reference-parameter to the UserFunc:

$resultArray = $this->initializeResultArray();
$parameterArray['resultArray'] =& $resultArray;
$resultArray['html'] = GeneralUtility::callUserFunction(
    $parameterArray['fieldConf']['config']['userFunc'],
    $parameterArray,
    $this
);
Actions #1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #2

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #3

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #4

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #5

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #7

Updated by Gerrit Code Review over 7 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #8

Updated by Gerrit Code Review about 6 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #9

Updated by Gerrit Code Review about 6 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49690

Actions #10

Updated by Christian Kuhn over 5 years ago

  • Status changed from Under Review to Rejected

i decided against this solution: a type=user with an own renderType is much more flexible than trying to extend the old school 'userFunc' bound solution.

renderType handling is exlpained meanwhile in core api docs: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/FormEngine/Rendering/Index.html

Actions

Also available in: Atom PDF