- Issue created by @hepabolu
- πΊπΈUnited States tr Cascadia
Yes, it appears a setting is not getting initialized. Since the code for that setting hasn't been changed for about 6 years, I suspect the error is due to core Drupal changes. I'm surprised no one has mentioned this before, but this is just one more reason why we desperately need test cases for this module - automated tests would have immediately started to fail when core got changed or when this module stopped working for other reasons, which could have prevented this situation.
I started to look at this and that took me down a rabbit hole of other things that are also major problems. I will work on pushing fixes over the next few weeks, but be aware this module is not a high priority for me because I'm not currently using it. The module depends on the votingapi module, which itself still needs some major fixes, and changing votingapi means changing votingapi_widgets and vice versa. The work on votingapi_widgets will be done in the 2.0.x branch, because that is the only branch that is going to be supported going forward into D11. There will be an initial release on the 2.0.x branch when I know this module works on D10.3+ and D11.
If this module is important to you please consider helping. Test cases are needed. Documentation is needed, issues need to be reviewed and patches need to be developed and manually tested - there are a lot of open issues that no one is commenting on or helping out with. This is not a commercial project, it's a community project. Just trying to keep these modules up-to-date with changes to core Drupal often exhausts my volunteer time.
- π³π±Netherlands hepabolu
Thanks for the explanation
I can try to help out but I have never written test cases for Drupal modules. Could you give me some pointers where I can find more information?
- πΊπΈUnited States tr Cascadia
I think the problem is due to this core change:
Field and Field Storage config entities now don't get saved until after the last step in the field creation workflow βThe change record has an example that doesn't apply to this module. We are using FieldConfig elsewhere, not in a hook, so we can't use the workaround suggested there.
I have a fix that seems to work, but again it would be nice to a have test here because something as fundamental as creating the field via the UI should be tested so we are notified when there are core changes like this which cause the functionality to fail.
- Merge request !24Issue #3496294 by tr: Creating new voting field crashes on Drupal 10.4 β (Merged) created by tr
- πΊπΈUnited States tr Cascadia
Please try out this fix and let me know if it solves the issue for you. It's working for me on my site, but I have a bunch of other changes that I've made locally, so I'm not sure this fix is complete - I may have to include some of my other changes in order to get it to work for you.
This will be addressed in the 2.0.x branch - it will not be backported to 8.x-1.x
- πΊπΈUnited States loze Los Angeles
Thanks @tr
The MR applies, but the error is still there when adding a new field.
Even after clearing the caches after applying the patch.
The website encountered an unexpected error. Try again later. Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\votingapi_widgets\Plugin\VotingApiWidgetManager are: fivestar, useful, like in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php). Drupal\Core\Plugin\DefaultPluginManager->getDefinition('') (Line: 16) Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('', Array) (Line: 83) Drupal\Component\Plugin\PluginManagerBase->createInstance('') (Line: 133) Drupal\votingapi_widgets\Plugin\Field\FieldWidget\VotingApiWidget->formElement(Object, 0, Array, Array, Object) (Line: 459) Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 219) Drupal\Core\Field\WidgetBase->formMultipleElements(Object, Array, Object) (Line: 120) Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 287) Drupal\Core\Field\FieldItemList->defaultValuesForm(Array, Object) (Line: 230) Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 107) Drupal\Core\Entity\EntityForm->buildForm(Array, Object) call_user_func_array(Array, Array) (Line: 536) Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 284) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48) Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'default', Array) (Line: 62) Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm('node', 'field_new') call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90) 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: 741) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
- πΊπΈUnited States tr Cascadia
OK.
When I tested, I initially wasn't able to add a field. My MR fixed that and now I am able to add a field.
I don't see the same error as you do, so there obviously must be something different on our sites.
Are you testing with the current version of Voting API and the current version of Voting API Widgets?
What version of Drupal core? I do most of my work on the latest version of Drupal 11 ...
I just added some more changes to the MR - these are the only other local changes I have that I think might impact this issue.
Can you try again please?
- πΊπΈUnited States loze Los Angeles
@tr, that last one did the trick!
I am now able to add new votingapi_widgets fields.
I'm currently testing on a relatively clean install of Drupal 10.4.2 and the latest 2.0.x version of votingapi_widgets
- πΊπΈUnited States tr Cascadia
I plan to commit this as soon as I get a test written to prove that this field can be created through the UI, which will incidentally prevent this from getting broken again.
- πΊπΈUnited States tr Cascadia
OK, here's a simple test. Might have to debug on the testbot.
- πΊπΈUnited States tr Cascadia
OK!
Look at the test results... The new test, VotingApiFieldTest, now passes!
This test simply uses the UI to add a new voting_api_field to a content type, then configures the field through the UI.
This is testing the exact situation that @hepabolu described in the original post.Note that the test PASSES with this MR, which includes the test and the fix.
More importantly, note that the "test only" pipeline, which includes just the test but not the fix, FAILS.This means that the test reproduces the problem, and ALSO proves that the fix works.
I'm happy. In addition, the process of writing the test pointed out a few errors in the codebase. Those are now corrected by the MR.
The code quality has gone up drastically, and a major bug has been fixed, all thanks to one test. This is EXACTLY why I am so insistent upon adding tests to this module.
- Status changed to Fixed
about 1 month ago 2:04am 26 February 2025 - πΊπΈUnited States loze Los Angeles
This is awesome! thanks so much @tr!
Automatically closed - issue fixed for 2 weeks with no activity.