Timeline for How do I in code add new field values to a D8 content entity?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 28, 2017 at 20:06 | comment | added | colan | I think we're supposed to set these to NULL as per Set entity values to NULL instead of using unset() method: unset() is misleading. | |
Nov 8, 2014 at 10:18 | comment | added | Berdir | I added a working script that I tested in my answer. | |
Nov 7, 2014 at 19:56 | comment | added | Letharion | @Berdir I actually tried that, I couldn't get it to work. IIRC the $delta's weren't what I expected, which was the source of the problem. I'll try again and report back. :) | |
Nov 7, 2014 at 19:05 | comment | added | Berdir | unset($entity->field_name[$delta)) works fine, you don't need to set the values again. | |
Nov 6, 2014 at 19:33 | history | answered | Letharion | CC BY-SA 3.0 |