Problem/Motivation

When creating an entity tab form mode, no operation class handler is set. As a result when EntityTypeManagerInterface::getFormObject is called, an uncatched InvalidPluginDefinitionException is thrown.

Steps to reproduce

  • fresh install
  • create a new vocabulary
  • create new form mode for taxonomy terms
  • navigate to admin/structure/taxonomy/entity_ui
  • create new form mode tab (#3281738: Fix missing config_export in EntityTab)
  • create new term in vocabulary
  • navigate to newly created tab -> exception

Issue fork entity_ui-3281740

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

attisan created an issue. See original summary.

attisan’s picture

Assigned: attisan » Unassigned
Status: Active » Needs review

Though I'm not 100% sure this is a good solution (actually feels rather sketchy) it does work for us.

joachim’s picture

Status: Needs review » Needs work

IIRC there is a core bug about this problem, which is that the entity type definition expects a form class to be defined for each form mode, but form modes defined in the UI don't define one.

We should reference this in the code here.

Also, the workaround should check for a form class for the form mode before it overwrites it.

attisan’s picture

Assigned: Unassigned » attisan

@joachim are you referring to #2530086: How can we access the new form modes?? I'll go ahead and update my MR including your mentioned checking (though it should, to my thinking never reach that point as paths are already checked before creation / Entity UI is only handling this request when it stems from a custom Entity tab - but checking won't hurt 😊)

attisan’s picture

Assigned: attisan » Unassigned
Status: Needs work » Needs review
joachim’s picture

> but checking won't hurt

It could be that there is some custom code (or even another contrib module -- I think I saw one?) which sets form classes on custom form modes. So we shouldn't clobber that.

Thanks for the tweak. Although, note that inline comments are marked with // and not /** */.

I've rebased the branch too, will merge it and make a new release as was the last of the showstoppers to fix.

  • joachim committed 56a19a6 on 8.x-1.x authored by attisan
    Issue #3281740 by attisan: Fixed crash on entity tab showing custom form...
joachim’s picture

Status: Needs review » Reviewed & tested by the community
joachim’s picture

Status: Reviewed & tested by the community » Fixed
attisan’s picture

Thanks for the tweak. Although, note that inline comments are marked with // and not /** */.

aaah, yes. sorry. Have been so keen to use @see and @todo, I forgot about the coding standard 🙈 😁

joachim’s picture

It's ok, I fixed it before merging.

Also I tweaked the @see -- I think the @see needs to be its own line, rather than part of a sentence.

Status: Fixed » Closed (fixed)

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