The default value is only respected when creating the entity trough a form. The patch ensures that the default value is also used with modules like restws, uif and feeds.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

karel010’s picture

karel010’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: mailchimp_lists-defaults-value-2375183-1-D7.patch, failed testing.

Status: Needs work » Needs review

  • ruscoe committed cc29ec6 on 7.x-3.x authored by karel010
    Issue #2375183 by karel010: Fixes values when entity with subscription...
ruscoe’s picture

Status: Needs review » Fixed

Tested and works, committed to the dev branch. Thanks for the patch!

Status: Fixed » Closed (fixed)

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

aasarava’s picture

Status: Closed (fixed) » Needs work

Sorry to reopen this, but this patch seems to inadvertently prevent new users from being subscribed to lists that they choose on the subscription form.

If you create a new user and select one or more lists, the user doesn't get subscribed to those lists and the user edit form shows the fields as unchecked.

I believe this is happening because the following lines of the patch just wipe out any field data in $choices:

    if ($entity->is_new) {
      $choices = $instance['default_value'][0];
    }

Maybe check to see if there's any value at all in $entity_wrapper->{$instance['field_name']} first?

ruscoe’s picture

Assigned: karel010 » ruscoe

  • ruscoe committed 8d1de27 on 7.x-3.x
    Issue #2375183 by karel010, aasarava: Default value broken.
    
ruscoe’s picture

Status: Needs work » Fixed

Good catch. Confirmed the issue and committed a fix. Thank you!

ruscoe’s picture

Assigned: ruscoe » Unassigned
aasarava’s picture

Great. It works. Thanks!

karel010’s picture

@ruscoe
8d1de27 does not work. $choices is always array('subscribed' => 0) when the field value is not provided in the entity. This is because entity_metadata_wrapper calls mailchimp_lists_field_get. Testing against $entity directly does work.

joelpittet’s picture

Status: Fixed » Needs review

Based on #14 moving to NW

Status: Needs review » Needs work

The last submitted patch, 14: mailchimp_lists-defaults-value-2375183-15-D7.patch, failed testing.

ruscoe’s picture

Assigned: Unassigned » ruscoe
karel010’s picture

Version: 7.x-3.2 » 7.x-3.x-dev

Status: Needs work » Needs review

  • ruscoe committed 2c98def on 7.x-3.x authored by karel010
    Issue #2375183 by karel010, aasarava, joelpittet: Default value broken
    
ruscoe’s picture

Status: Needs review » Fixed

Thank you, @karel010

ruscoe’s picture

Assigned: ruscoe » Unassigned

Status: Fixed » Closed (fixed)

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