Posted by Wim Leers on
Change record status:
Published (View all published change records)
Introduced in branch:
- In Drupal 7,
drupalPostAJAX()both have deeply embedded assumptions that they're being applied to forms.
- In Drupal 8, we now have POST requests that receive
application/vnd.drupal-ajaxresponses. (e.g. rendering of AJAXy Views, contextual links, Edit module's metadata, etc.). Hence there is a need to simulate HTTP POST requests that aren't processed by a form controller. These were condemned to use
- A new
drupalPost()method, with a different signature than Drupal 7 one, has been introduced in Drupal 8 to deal with these requirements.
- The former
drupalPostAJAX()methods have been renamed, while retaining the original arguments:
- Before (Drupal 7):
... $this->drupalPost('admin/config/development/logging', $edit, t('Save configuration')); ...
- After (Drupal 8):
... $this->drupalPostForm('admin/config/development/logging', $edit, t('Save configuration')); ...