function SystemTestHooks::pageAttachments

Implements hook_page_attachments().

File

core/modules/system/tests/modules/system_test/src/Hook/SystemTestHooks.php, line 101

Class

SystemTestHooks
Hook implementations for system_test.

Namespace

Drupal\system_test\Hook

Code

public function pageAttachments(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.