router_test.module

Same filename in other branches
  1. 11.x core/modules/system/tests/modules/router_test_directory/router_test.module

Test module.

File

core/modules/system/tests/modules/router_test_directory/router_test.module

View source
<?php


/**
 * @file
 * Test module.
 */
use Drupal\Core\Url;

/**
 * Implements hook_preprocess_HOOK().
 *
 * Performs an operation that calls the RouteProvider's collection method
 * during an exception page view. (which is rendered during a subrequest.)
 *
 * @see \Drupal\FunctionalTests\Routing\RouteCachingQueryAlteredTest
 */
function router_test_preprocess_page(&$variables) {
    $request = \Drupal::request();
    if ($request->getPathInfo() === '/router-test/rejects-query-strings') {
        // Create a URL from the request, e.g. for a breadcrumb or other contextual
        // information.
        Url::createFromRequest($request);
    }
}

Functions

Title Deprecated Summary
router_test_preprocess_page Implements hook_preprocess_HOOK().

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