Problem/Motivation
Hi, thanks for this excellent module.
I have recently noticed that if you have both, Layout Paragraphs and Field Group Module activated, an error is generated that prevents adding new paragraphs. When you click on the add paragraph button (in node/edit), the loader is displayed but never loads the modal window.
Steps to reproduce
Just activate Field group and the issue appears. As soon as Field Group is disabled it disappears.
Errors in console:
js_21Ozn8Y_cs27kOqKPuSyHJWPP-k0rIyS42PUFxGQpws.js:2 POST http://local.mydomain:8888/node/1/edit?destination=/admin/content&ajax_f... 500 (500 Service unavailable (with message))
js_21Ozn8Y_cs27kOqKPuSyHJWPP-k0rIyS42PUFxGQpws.js:1499 Uncaught Drupal.AjaxError {message: "↵Hubo un error HTTP AJAX.↵Código de Resultado HTTP… error inesperado. Vuelva a intentarlo más tarde.", name: "AjaxError"}
Drupal: 9.0.2
Layout Paragraphs: 1.0.0-beta3 (also in 1.0.x-dev)
Field Group: 8.x-3.1
Admin theme: Seven
Thanks in advance!
Comment | File | Size | Author |
---|---|---|---|
#2 | field_group_support--3161489-2.patch | 1.64 KB | Dom. |
layout-paragraph-not-working.png | 100.48 KB | ktegory |
Comments
Comment #2
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedThe reason for this can be found in the logs :
Drupal\Core\Security\UntrustedCallbackException : Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was field_group_form_pre_render. See https://www.drupal.org/node/2966725 dans Drupal\Core\Render\Renderer->doTrustedCallback() (ligne 96 de C:\wamp\www\freelance-drupal\web\core\lib\Drupal\Core\Security\DoTrustedCallbackTrait.php).
This module uses "field_group_form_pre_render" function in '#pre_render'. This method is deprecated in field_group and kept for BC reason.
The solution is litterally in the documentation of that method and usage can be found in the paragraph widgets of paragraph module itself: use
[FormatterHelper::class, 'formProcess']
if defined.The patch attached does just that. The code comes from
ParagraphWidget.php
andInlineParagraphWidget.php
code.Comment #3
ktegory CreditAttribution: ktegory commentedThanks Dom!
I'm going to apply this patch and test how it works in my installation.
Comment #4
ktegory CreditAttribution: ktegory commentedJust to confirm that in my case, the patch from @Dom. in #2 works as expected.
Comment #6
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedThanks y'all! Just pushed #2 to 1.0.x.
Comment #8
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedFound an issue with patch #2 actually -- it was targeting the wrong form element key ("subform" instead of "entity_form"). Fixed in latest commit, just documenting here.