You are here

public function CommonTestController::jsAndCssQuerystring in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php \Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring()

Adds a JavaScript file and a CSS file with a query string appended.

Return value

string An empty string.

1 string reference to 'CommonTestController::jsAndCssQuerystring'
common_test.routing.yml in core/modules/system/tests/modules/common_test/common_test.routing.yml
core/modules/system/tests/modules/common_test/common_test.routing.yml

File

core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php, line 63

Class

CommonTestController
Controller routines for common_test routes.

Namespace

Drupal\common_test\Controller

Code

public function jsAndCssQuerystring() {
  $attached = [
    '#attached' => [
      'library' => [
        'node/drupal.node',
      ],
      'css' => [
        drupal_get_path('module', 'node') . '/css/node.admin.css' => [],
        // A relative URI may have a query string.
        '/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2' => [],
      ],
    ],
  ];
  return \Drupal::service('renderer')
    ->renderRoot($attached);
}