You are here

protected function WebTestBase::getAjaxPageStatePostData in Drupal 8

Get the Ajax page state from drupalSettings and prepare it for POSTing.

Return value

array The Ajax page state POST data.

1 call to WebTestBase::getAjaxPageStatePostData()
WebTestBase::drupalPostAjaxForm in core/modules/simpletest/src/WebTestBase.php
Executes an Ajax form submission.

File

core/modules/simpletest/src/WebTestBase.php, line 1406

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function getAjaxPageStatePostData() {
  $post = [];
  $drupal_settings = $this->drupalSettings;
  if (isset($drupal_settings['ajaxPageState']['theme'])) {
    $post['ajax_page_state[theme]'] = $drupal_settings['ajaxPageState']['theme'];
  }
  if (isset($drupal_settings['ajaxPageState']['theme_token'])) {
    $post['ajax_page_state[theme_token]'] = $drupal_settings['ajaxPageState']['theme_token'];
  }
  if (isset($drupal_settings['ajaxPageState']['libraries'])) {
    $post['ajax_page_state[libraries]'] = $drupal_settings['ajaxPageState']['libraries'];
  }
  return $post;
}