Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I ran into this issue when trying to set a Link field to null. I could correctly set it with:
$wrapper->{$link_field}->set(array('url' => NULL));
or
$wrapper->{$link_field}->set(NULL);
But I could not set it with
$wrapper->{$link_field}->url->set(NULL);
When I dug into the code, I saw the reason for this. The link_field_property_info_callback() function was only considering URL and Title's individual requirement rather also including the field's requirement.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2675568-1.patch | 854 bytes | pianomansam |
|
Comments
Comment #2
pianomansam CreditAttribution: pianomansam commentedHere's a patch that solves this problem for me.
Comment #3
pianomansam CreditAttribution: pianomansam commentedComment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 4 year old patch in #2 to link.module applied cleanly to the latest link 7.x-1.x-dev and solves this problem for me as well.
Comment #5
pifagorComment #7
pifagor