Ok guys,
I have the confirmation that the issue is related to commerce in my case.
The freak variables are isolated with this code :
if($plugin_id=="Commerce") {
echo "<pre>";
print_r($definitions);
echo "</pre><br>";
} else {
// Avoid using a ternary that would create a copy of the array.
if (isset($definitions[$plugin_id])) {
return $definitions[$plugin_id];
}
elseif (!$exception_on_invalid) {
return NULL;
}
}
The add field form is working now, even if the problem is not solved.
At the moment I don't understand what's happening.
hi there,
I'm facing this issue with d11.
Everything was working pretty good, and this morning... field additions broke on content type, product types, commerce types, etc.
I tried to trace the problem by adding a line of code in the DiscoveryTrait file :
if (isset($plugin_id)) { print($plugin_id); echo "<br>"; }
It results in a long list, in which the last value is "Commerce" (with cap).
I lowercased $plugin_id, and it finally throws another error :
TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup on array in Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (line 141 of core/modules/field_ui/src/Form/FieldStorageAddForm.php).
The last value displayed in my list is "general".
Hope it helps ... it's my sixth hour of research :D I need a break and a pizza !
Well, I didn't do custom modifications or hacks, just updated core and the previously installed contrib modules.
Anyway, I'll use address field instead of text, and it will be ok :D
I submitted the error:
https://www.drupal.org/project/address/issues/3412340#comment-15383859
🐛
Error with address suggestion module
Active
It seems that address module is not the cause.
Thanks Bojanz, and sorry for the misclassification.
I'll do that,
Thanks again.
Re,
As the address field displays the country code and two labels, I prefered to use the text field.
I finally have the detailed error :
Warning: Undefined array key "address" in Drupal\address\Plugin\Field\FieldWidget\AddressDefaultWidget->massageFormValues() (line 200 of modules/contrib/address/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php).
Drupal\address\Plugin\Field\FieldWidget\AddressDefaultWidget->massageFormValues(Array, Array, Object) (Line: 494)
Drupal\Core\Field\WidgetBase->extractFormValues(Object, Array, Object) (Line: 240)
Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues(Object, Array, Object) (Line: 334)
Drupal\Core\Entity\ContentEntityForm->copyFormValuesToEntity(Object, Array, Object) (Line: 301)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 155)
Drupal\Core\Entity\ContentEntityForm->buildEntity(Array, Object) (Line: 186)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_ticket_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('node_ticket_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('node_ticket_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default') (Line: 191)
Drupal\formblock\Plugin\Block\NodeFormBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback('Drupal\block\BlockViewBuilder::preRender', Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 858)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'Drupal\block\BlockViewBuilder::preRender', Array) (Line: 421)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 493)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 99)
__TwigTemplate_5f2b9c65249ae8d64f0c9c7b22ba5755->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('themes/custom/n5ut/templates/layout/page--node--1.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 91)
__TwigTemplate_57d45203095cb6667694709689354496->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('themes/custom/n5ut/templates/layout/html.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Many thanks for your really quick answer.
I tested the module with an address field, it works.
Do you tried with a simple text field ?
I searched the error in the code, and I find it here :
- commerce\modules\tax\tests\src\Kernel\TaxNumberItemTest.php /// line 234
- inline_entity_form\tests\src\FunctionalJavascript\ComplexWidgetTest.php /// line 513
The mystery thickens...
Hello guys,
Not sure it works, I have that message after submission : This value should not be null.
This is on a text field that is not empty. Suggestions appears properly. No error in the watchdog ...
I'm interested.
I need to offer subscription products with multiple recurrence periods. If the product is released for the day, it must also be released for the week and the months since it is temporarily unavailable.
Genius.
Thank you very much!