function system_test_page_attachments

Same name in other branches
  1. 9 core/modules/system/tests/modules/system_test/system_test.module \system_test_page_attachments()
  2. 8.9.x core/modules/system/tests/modules/system_test/system_test.module \system_test_page_attachments()

Implements hook_page_attachments().

File

core/modules/system/tests/modules/system_test/system_test.module, line 95

Code

function system_test_page_attachments(array &$page) {
    // Used by FrontPageTestCase to get the results of
    // \Drupal::service('path.matcher')->isFrontPage().
    $frontpage = \Drupal::state()->get('system_test.front_page_output', 0);
    if ($frontpage && \Drupal::service('path.matcher')->isFrontPage()) {
        \Drupal::messenger()->addStatus(t('On front page.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.