I just installed the consumer module (8.x-1.10) as I want to use the Consumer Image Style module. On 'admin/config/services/consumer' page, whenever I click '+Add Consumer' button or 'edit' button for the default consumer, the following error shows:

Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::getThirdPartySettings() in filefield_paths_field_widget_form_alter() (line 217 of modules/contrib/filefield_paths/filefield_paths.module).
filefield_paths_field_widget_form_alter(Array, Object, Array) (Line: 539)
Drupal\Core\Extension\ModuleHandler->alter('field_widget_form', Array, Object, Array) (Line: 355)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 162)
Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements(Object, Array, Object) (Line: 116)
Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements(Object, Array, Object) (Line: 113)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 178)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 125)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 17)
Drupal\consumers\Entity\Form\ConsumerForm->form(Array, Object) (Line: 144)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 520)
Drupal\Core\Form\FormBuilder->retrieveForm('consumer_edit_form', Object) (Line: 277)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Currently, I am using Drupal Core 8.8.1 and updated everything to the latest version. Any ideas on how to fix it?

Thanks,

CommentFileSizeAuthor
#7 3105435-7.patch481 bytesvikib
#3 3105435-3.patch119.59 KBvikib

Comments

sprklinginfo created an issue. See original summary.

eojthebrave’s picture

Status: Active » Postponed (maintainer needs more info)

Hey @sprklinginfo, thanks for reporting this issue.

I was unable to replicate this with Consumers 8.x-1.10, and Drupal core 8.8.2. Looking at the trace, it seems like filefield_paths module is the likely culprit here. My best guess is it's related to this issue https://www.drupal.org/project/filefield_paths/issues/2718783, though I haven't tried the patch there yet. Could you give that patch a try, or disable filefield_paths, and see if this issue goes away?

If that does resolve the issue feel free to mark this one as fixed, and maybe add a link to the original post pointing anyone that lands here to the filefield_paths issue.

If it doesn't fix the problem I can try installing filefield_paths sometime in the future and seeing if that causes issues for me too.

vikib’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new119.59 KB

Hello,

I would like to reopen the issue since I suspect this bug has a relation with silent fallbacks.

So it obviously has a connection to the following issue:
https://www.drupal.org/project/drupal/issues/3085167

As an evidence I’m providing the Drupal shell output demonstrating the issue in action:

Psy Shell v0.9.12 (PHP 7.3.14 — cli) by Justin Hileman
>>> \Drupal::service('plugin.manager.field.widget')->getDefinition('image_image')
=> [
     "field_types" => [
       "image",
     ],
     "multiple_values" => false,
     "id" => "image_image",
     "label" => Drupal\Core\StringTranslation\TranslatableMarkup {#4060},
     "class" => "Drupal\image\Plugin\Field\FieldWidget\ImageWidget",
     "provider" => "image",
   ]
>>> \Drupal::service('plugin.manager.field.widget')->getDefinition('image')
Drupal/Component/Plugin/Exception/PluginNotFoundException with message 'The "image" plugin does not exist. Valid plugin IDs for Drupal/Core/Field/WidgetPluginManager are: moderation_state_default, datetime_datelist, datetime_default, file_generic, image_image, layout_builder_widget, link_default, oembed_textfield, media_library_widget, path, text_textarea, text_textfield, text_textarea_with_summary, options_select, string_textfield, entity_reference_autocomplete, language_select, string_textarea, number, entity_reference_autocomplete_tags, uri, email_default, options_buttons, boolean_checkbox, datetime_timestamp'
vikib’s picture

Hello,

I would like to reopen the issue since I suspect this bug has a relation with silent fallbacks.
So it obviously has a connection to the following:
#3085167: No exception on missing widget or formatter, but a silent fallback

As an evidence I’ll provide the Drupal shell output demonstrating the issue in action:

Psy Shell v0.9.12 (PHP 7.3.14 — cli) by Justin Hileman
>>> \Drupal::service('plugin.manager.field.widget')->getDefinition('image_image')
=> [
     "field_types" => [
       "image",
     ],
     "multiple_values" => false,
     "id" => "image_image",
     "label" => Drupal\Core\StringTranslation\TranslatableMarkup {#4060},
     "class" => "Drupal\image\Plugin\Field\FieldWidget\ImageWidget",
     "provider" => "image",
   ]
>>> \Drupal::service('plugin.manager.field.widget')->getDefinition('image')
Drupal/Component/Plugin/Exception/PluginNotFoundException with message 'The "image" plugin does not exist. Valid plugin IDs for Drupal/Core/Field/WidgetPluginManager are: moderation_state_default, datetime_datelist, datetime_default, file_generic, image_image, layout_builder_widget, link_default, oembed_textfield, media_library_widget, path, text_textarea, text_textfield, text_textarea_with_summary, options_select, string_textfield, entity_reference_autocomplete, language_select, string_textarea, number, entity_reference_autocomplete_tags, uri, email_default, options_buttons, boolean_checkbox, datetime_timestamp'
vikib’s picture

vikib’s picture

vikib’s picture

StatusFileSize
new481 bytes

After careful examination this is place where the issue is occur.
The ‘type’ => ‘image’ should be replaced with the ‘image_image’.

hchonov’s picture

Title: Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::getThirdPartySettings() » Invalid widget plugin ID is used on the consumer's field "image"
Status: Needs review » Reviewed & tested by the community

As already mentioned the widget plugin ID "image" is invalid, instead it is called "image_image". The exception is not thrown when simply accessing the form as then a fallback to the default widget for the field type is silently activated, however with custom or contrib code this could fail when the definition is retrieved.

  • eojthebrave committed 6fcd833 on 8.x-1.x authored by vikib
    Issue #3105435 by vikib, sprklinginfo, eojthebrave, hchonov: Invalid...
eojthebrave’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @vikib for the patch. I committed this patch + some update code in consumers.install. And thank you @sprklinginfo for originally reporting this, and @hchonov for helping with review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.