Active
Project:
Primary Entity Reference
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2026 at 15:11 UTC
Updated:
3 Feb 2026 at 20:07 UTC
Jump to comment: Most recent
The application logic that only one item in a field can be the primary is only enforced at the widget level. It should be enforced with a constraint.
// Create a node with 2 values, then load it and do this:
$node->field_test_per[0]->primary = 1;
$node->field_test_per[1]->primary = 1;
dsm($node->validate()); // This should show a validation error, but it does not!
$node->save();
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
Comment #2
bluegeek9 commented