Example config:

Node types: Car, Part
Entity reference field parts on car.
Inline entity form (Multiple) "Parts" on "Car"
Flag "Working" on Car.

When adding a Part at the Car form, node type is required, otherwise the following error will appear:

Notice: Undefined index: type in flag_field_attach_form() (line 727 of flag.module).

Patch attached.

Files: 
CommentFileSizeAuthor
#7 2109041.flag_.form-node-type.patch643 bytesjoachim
PASSED: [[SimpleTest]]: [MySQL] 266 pass(es).
[ View ]
#1 ief-add-type-to-node-form.patch607 bytesjgullstr

Comments

StatusFileSize
new607 bytes

Forgot patch

Assigned:jgullstr» Unassigned
Issue summary:View changes

Title:Compability with flag moduleInline Entity Form / Flag compatibility
Project:Inline Entity Form» Flag
Version:7.x-1.3» 7.x-3.x-dev
Component:Code» Flag core

I have no problem with committing that workaround to IEF, but I first want to ask the Flag team why they need to depend on a value from the node form in their field_attach_form implementation. Can't $entity->type be used instead?

You mean this bit:

      // Apply the per-bundle defaults for nodes.
      if ($entity_type == 'node') {
        $flag_status = variable_get('flag_' . $flag->name . '_default_' . $form['type']['#value'], 0);
      }

My only hunch is that it could be because on node creation forms there is no node object. I don't remember if that's the case or not.

I'll take a patch, but ideally with tests to show it still works!

Well nobody can call field_attach_form() without an $entity, so I don't know how there can be no node object.
I won't be supplying patches, just reporting that I detect possible code smell :)

Ah, right you are.

Patch without tests should be fine then -- though I was fishing for one from the OP rather than bojanz ;)

StatusFileSize
new643 bytes
PASSED: [[SimpleTest]]: [MySQL] 266 pass(es).
[ View ]

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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