Problem/Motivation

I have a use case with an entity type with many bundles that can be referenced, but based on the context of how the form is loaded, the entity bundle we want to reference is known. Therefore, I'd like to default to that bundle and have the form open.

Proposed resolution

I've attached a patch that is a simple refactor to InlineEntityFormSimple which makes my use case super easy to implement in custom code. However we could consider implementing this widget directly in IEF if there is interest

Remaining tasks

Review.

CommentFileSizeAuthor
#2 ief-widget.png50.4 KBbenjy
#2 2898030-2.patch1.14 KBbenjy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benjy created an issue. See original summary.

benjy’s picture

Status: Active » Needs review
FileSize
1.14 KB
50.4 KB

Attached is the patch that simply allows me to override the bundle in my custom widget.

Here's an idea of what my custom widget looks like in case that would be worthwhile contributing back?

IEF widget sample

darvanen’s picture

Status: Needs review » Reviewed & tested by the community

I see no reason not to refactor this piece of code and the patch applies cleanly.

  • bojanz committed 1c52fca on 8.x-1.x authored by benjy
    Issue #2898030 by benjy: Provide a "default bundle" widget
    
bojanz’s picture

Status: Reviewed & tested by the community » Fixed

No reason not to do this. Cleaned up getBundle() a bit to get rid of the ternary. Thanks!

As for the custom widget itself, I don't know how that would work inside IEF itself, but we can discuss in a followup.

Status: Fixed » Closed (fixed)

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

joachim’s picture

Please don't blindly take the commit message d.org offers!

> Issue #2898030 by benjy: Provide a "default bundle" widget

That does not describe at all what was changed here!