When adding a custom field to a MailChimp Subscriber List the module causes an error because the options set by MailChimp do not include a size for the field and the default textfield is used which defines a size. Below is an abbreviated output of the error:
Error messageNotice: Undefined property: stdClass::$size in mailchimp_insert_drupal_form_tag() (line 1162 of modules/contrib/mailchimp/mailchimp.module).
mailchimp_insert_drupal_form_tag(Object) (Line: 124)
Drupal\mailchimp_signup\Form\MailchimpSignupPageForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 512)
Drupal\Core\Form\FormBuilder->retrieveForm('mailchimp_signup_subscribe_block_contact_the_gatesworth_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('mailchimp_signup_subscribe_block_contact_the_gatesworth_form', Object) (Line: 212)
Drupal\Core\Form\FormBuilder->getForm(Object) (Line: 35)
Comment | File | Size | Author |
---|---|---|---|
#24 | 2788129-custom-field-undefine-property-23.patch | 871 bytes | Henry Tran |
Comments
Comment #2
Daniel KorteThe attached patch fixes the issue by giving the phone field it's own case in the switch statement and with the added benefit of using the HTML5 tel form field.
Comment #3
Daniel KorteComment #4
Daniel KorteComment #5
MaskOta CreditAttribution: MaskOta commentedThis is not a problem only for phone fields but any custom field.
The module assumes the size was set. I think we should do a check if the size was set and if it was not we should apply a default value. I put in size = 25 because i think this is the default for other fields.
Comment #6
MaskOta CreditAttribution: MaskOta commentedI uploaded the wrong patch...
Comment #7
Daniel KorteI think the two patches should be combined so that the telephone HTML5 input type is still used for telephone fields. Thoughts?
Comment #8
MaskOta CreditAttribution: MaskOta commentedI think it would require to open a separate issue.
Comment #9
MaskOta CreditAttribution: MaskOta commentedComment #10
joelstein CreditAttribution: joelstein as a volunteer commentedI'm seeing the same thing on Drupal 7. Here's a D7 patch.
Comment #11
Greg BoggsComment #12
echoz CreditAttribution: echoz commentedThe D7 patch, in #10 also works to get rid of the notice filling up the logs when viewing the mailchimp form on the site. Can this also get backported to D7?
Comment #13
jesss CreditAttribution: jesss commentedThe D7 patch in #10 is working for me as well. +1 for the backport.
Comment #14
Funkwarrior CreditAttribution: Funkwarrior as a volunteer commentedremove post...
Comment #15
jesss CreditAttribution: jesss commentedThe D7 patch #14 works for me.
Comment #16
basvredelingnew patch because #14 didn't apply to latest 7.x-4.x-dev anymore
Comment #17
dietr_ch CreditAttribution: dietr_ch at EntityOne commentedPatch in #6 still works with 8.x-1.2.
Comment #18
basvredelingThe patch from #16 is no longer necessary. Current dev code already includes this solution.
Comment #19
Greg BoggsIt looks like the 2 d8 patches need work to be combined as the thread got reused by the D7 patch.
Comment #20
spidermanI've rolled a combined d8 patch including the telephone fix and the size fix. Thanks to MaskOta and Daniel Korte for their efforts :)
Comment #21
DrIPA CreditAttribution: DrIPA commented#20 works for me, thanks!
Comment #22
gcbComment #23
Henry Tran CreditAttribution: Henry Tran at Deloitte Digital commentedI've re rolled to mailchimp 2.x
Comment #24
Henry Tran CreditAttribution: Henry Tran at Deloitte Digital commentedI've re rolled to mailchimp 2.x, upload again
Comment #26
xenophyle CreditAttribution: xenophyle commented