You are here

function system_test_page_attachments in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/system_test/system_test.module \system_test_page_attachments()
  2. 9 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 87
Test module.

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.'));
  }
}