Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
A fatal error is shown when you try to edit a payment.
Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "payment" entity type did not specify a "edit" form class. in Drupal\Core\Entity\EntityManager->getFormObject() L:290
There was an issue 4 months ago that removed the edit form, but the operations link is still there.
Proposed resolution
Either remove editing payments altogether or provide a form to edit payments after they have been created.
Remaining tasks
Discuss, write patch, review, commit.
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#12 | remove_the_edit_payment-2506911-12.patch | 1.62 KB | LKS90 |
#10 | Screen Shot 2015-06-17 at 15.49.01.png | 31.81 KB | LKS90 |
#8 | remove_the_edit_payment-2506911-8.patch | 567 bytes | LKS90 |
#6 | remove_the_edit_payment-2506911-6.patch | 482 bytes | LKS90 |
Comments
Comment #1
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedI swear I copied the related issue somewhere! :D
Comment #2
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedComment #3
XanoThanks for reporting this! I forgot to remove the operation when I remove the edit form. The reason the form was removed, is that payments are not editorial content and code that creates payments is responsible for editing them if applicable.
If this breaks your use case, could you please explain what you're trying to do? Maybe's there is a better solution, either for Payment or for your project.
Comment #4
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedThere is currently no use case and we propose to create a followup for this debate.
This issue is only about fixing the user confusion caused by the fatal error such as 'What edit functionality am i missing on this inaccessible tab?'
Comment #5
XanoIf you're okay with not having an edit form right now, let's remove the operation link and fix the WTF here. Could you write a patch?
Comment #6
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedSorry, took some time.
Here is the patch, it's a simple change where I unset the edit in the buildOperations() method.
Comment #7
XanoI understand. I checked the parent class and realized that the real reason that operation still appears is that the payment entity type's annotation still contains a
edit-form
link template. The real fix is to remove that line. Is that something you could do?Comment #8
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedBetter patch, just don't forget to drush cr after applying (like I did the first time).
Comment #9
XanoHeh, yeah, otherwise plugin definitions aren't cleared (those include entity types, as they are technically plugins as well).
Did you confirm that this also removes the operation from the UI?
Thanks a bunch! If the tests pass I'll commit this.
Comment #10
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedYep, tested it with our demo site. Added a screenshot for you :D.
There is still the entity.payment.edit_form:in the payment.routing.yml, should I also remove that? As I understand there is no option to edit payments anymore, so that should be dead configuration.
Comment #11
XanoThanks for the screen shot!
Yes, please. There is also a local task in payment.links.task.yml.
Comment #12
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedThe patch that does all the things.
Comment #13
BerdirLooks like this is removing all the relevant parts.
Testbot dependencies are apparently broken again, and there are some branch test fails, so I think we should just commit this, as this should also fix the dependencies again for now and we'll see the what exactly is failing.
Comment #14
XanoLet's make it so.
Comment #18
LKS90 CreditAttribution: LKS90 at MD Systems GmbH commentedComment #19
XanoIssues are set to Closed (fixed) automatically after they've been set to fixed for two weeks and nothing has happened. This leaves them visible in the queue for those two weeks, so people can spot what's changed recently.