I want to prepopulate mailchimp signup form in this way (Drupal 8):

newsletter?edit[mergevars][EMAIL]=test@test.com

The result is the following error message (check_plain() function is not part of Drupal 8!):

Error: Call to undefined function Drupal\prepopulate\Controller\check_plain() in Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk() (line 66 of modules/prepopulate/src/Controller/prepopulateController.php).
Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk(Array, 'test@test.com') (Line: 57)
Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk(Array, Array) (Line: 57)
Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk(Array, Array) (Line: 35)
prepopulate_after_build(Array, Object)
call_user_func_array('prepopulate_after_build', Array) (Line: 1053)
Drupal\Core\Form\FormBuilder->doBuildForm('mailchimp_signup_subscribe_page_newsletter_form', Array, Object) (Line: 557)
.....

I think
SafeMarkup::checkPlain() should be used instead.
Right?

Comments

drupalfan2 created an issue. See original summary.

znak’s picture

Assigned: Unassigned » znak
znak’s picture

Assigned: znak » Unassigned
Status: Active » Needs review
StatusFileSize
new1.44 KB

Added patch for fix this problem.

drupalfan2’s picture

Thank you for your patch.

In the meantime I solved my problem without prepopulate module using some custom jQuery code.

There seems to be another problem prepopulationg mailchimp: https://www.drupal.org/node/2890440

colan’s picture

Status: Needs review » Reviewed & tested by the community

Html::escape() makes sense as per the documentation.

I need this for #2849432: Simplify Prepopulate implementation with the Entity API (so maybe don't commit this directly).

Please review the patch over there.

damienmckenna’s picture

Version: 8.x-2.0-alpha1 » 8.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

This needs to be rerolled after #2849432 was committed.

damienmckenna’s picture

Status: Needs work » Closed (outdated)
Related issues: +#2849432: Simplify Prepopulate implementation with the Entity API

Actually, I think this is no longer an issue as "check_plain" no longer exists in the codebase.