Commit 1b4f1046 authored by webchick's avatar webchick
Browse files

Issue #1987656 by mparker17: Convert common_test_js_and_css_querystring() to a...

Issue #1987656 by mparker17: Convert common_test_js_and_css_querystring() to a new style controller.
parent 61de4962
......@@ -15,12 +15,6 @@ function common_test_menu() {
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['common-test/query-string'] = array(
'title' => 'Test querystring',
'page callback' => 'common_test_js_and_css_querystring',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
......@@ -212,18 +206,6 @@ function common_test_library_info() {
return $libraries;
}
/**
* Adds a JavaScript file and a CSS file with a query string appended.
*/
function common_test_js_and_css_querystring() {
drupal_add_library('system', 'drupalSettings');
drupal_add_js(drupal_get_path('module', 'node') . '/node.js');
drupal_add_css(drupal_get_path('module', 'node') . '/css/node.admin.css');
// A relative URI may have a query string.
drupal_add_css('/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2');
return '';
}
/**
* Implements hook_cron().
*
......
......@@ -11,3 +11,10 @@ common_test_drupal_render_invalid_keys:
_content: '\Drupal\common_test\Controller\CommonTestController::drupalRenderInvalidKeys'
requirements:
_permission: 'access content'
common_test_js_and_css_querystring:
pattern: '/common-test/query-string'
defaults:
_title: 'Test querystring'
_content: '\Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring'
requirements:
_permission: 'access content'
......@@ -73,4 +73,19 @@ public function drupalRenderInvalidKeys() {
return drupal_render($element);
}
/**
* Adds a JavaScript file and a CSS file with a query string appended.
*
* @return string
* An empty string.
*/
public function jsAndCssQuerystring() {
drupal_add_library('system', 'drupalSettings');
drupal_add_js(drupal_get_path('module', 'node') . '/node.js');
drupal_add_css(drupal_get_path('module', 'node') . '/css/node.admin.css');
// A relative URI may have a query string.
drupal_add_css('/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2');
return '';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment