Commit 2bd155b1 authored by catch's avatar catch

Issue #1861676 by sun: Remove stylesheets[] and scripts[] .info file property support for modules.

parent adc8b1e7
......@@ -4,5 +4,4 @@ package = Core
version = VERSION
core = 8.x
configure = admin/config/services/aggregator/settings
stylesheets[all][] = aggregator.theme.css
dependencies[] = file
......@@ -310,6 +310,7 @@ function theme_aggregator_summary_item($variables) {
* @see aggregator-wrapper.tpl.php
*/
function template_preprocess_aggregator_wrapper(&$variables) {
drupal_add_css(drupal_get_path('module', 'aggregator') . '/aggregator.theme.css');
$variables['pager'] = theme('pager');
}
......
......@@ -5,4 +5,3 @@ version = VERSION
core = 8.x
dependencies[] = node
configure = admin/content/book/settings
stylesheets[all][] = book.theme.css
......@@ -1082,6 +1082,7 @@ function template_preprocess_book_all_books_block(&$variables) {
* @see book-navigation.tpl.php
*/
function template_preprocess_book_navigation(&$variables) {
drupal_add_css(drupal_get_path('module', 'book') . '/book.theme.css');
$book_link = $variables['book_link'];
// Provide extra variables for themers. Not needed by default.
......
......@@ -6,4 +6,3 @@ core = 8.x
dependencies[] = node
dependencies[] = text
configure = admin/content/comment
stylesheets[all][] = comment.theme.css
......@@ -81,6 +81,7 @@ protected function alterBuild(array &$build, EntityInterface $comment, $view_mod
// Add indentation div or close open divs as needed.
if ($is_threaded) {
$build['#attached']['css'][] = drupal_get_path('module', 'comment') . '/comment.theme.css';
$prefix .= $comment->divs <= 0 ? str_repeat('</div>', abs($comment->divs)) : "\n" . '<div class="indented">';
}
......
......@@ -5,4 +5,3 @@ version = VERSION
core = 8.x
dependencies[] = field_sql_storage
required = TRUE
stylesheets[all][] = theme/field.css
......@@ -1103,6 +1103,14 @@ function field_extract_bundle($entity_type, $bundle) {
}
}
/**
* Implements hook_page_build().
*/
function field_page_build(&$page) {
$path = drupal_get_path('module', 'field');
$page['#attached']['css'][$path . '/theme/field.css'] = array('every_page' => TRUE);
}
/**
* Theme preprocess function for theme_field() and field.tpl.php.
*
......
......@@ -8,4 +8,3 @@ package = Core
version = VERSION
core = 8.x
configure = admin/structure/forum
stylesheets[all][] = forum.css
......@@ -34,5 +34,18 @@ function forum_page($forum_term = NULL) {
$topics = '';
}
return theme('forums', array('forums' => $forum_term->forums, 'topics' => $topics, 'parents' => $forum_term->parents, 'tid' => $forum_term->tid, 'sortby' => $sortby, 'forums_per_page' => $forum_per_page));
$build = array(
'#theme' => 'forums',
'#forums' => $forum_term->forums,
'#topics' => $topics,
'#parents' => $forum_term->parents,
'#tid' => $forum_term->tid,
'#sortby' => $sortby,
'#forums_per_page' => $forum_per_page,
);
$build['#attached']['css'][] = drupal_get_path('module', 'forum') . '/forum.css';
// @todo Returning a render array causes template_preprocess_forums() to be
// invoked too late and the breadcrumb is rendered before that callback
// adjusted it.
return drupal_render($build);
}
......@@ -578,7 +578,7 @@ private function verifyForumView($forum, $parent = NULL) {
// View forum page.
$this->drupalGet('forum/' . $forum['tid']);
$this->assertResponse(200);
$this->assertTitle($forum['name'] . ' | Drupal', 'Forum name was displayed');
$this->assertTitle($forum['name'] . ' | Drupal');
$breadcrumb = array(
l(t('Home'), NULL),
......@@ -588,7 +588,7 @@ private function verifyForumView($forum, $parent = NULL) {
$breadcrumb[] = l($parent['name'], 'forum/' . $parent['tid']);
}
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)));
}
/**
......
......@@ -4,5 +4,3 @@ package = Core
version = VERSION
core = 8.x
dependencies[] = node
stylesheets[all][] = poll.base.css
stylesheets[all][] = poll.theme.css
......@@ -118,6 +118,15 @@ function _poll_menu_access($node, $perm, $inspect_allowvotes) {
return user_access($perm) && ($node->type == 'poll') && ($node->allowvotes || !$inspect_allowvotes);
}
/**
* Implements hook_page_build().
*/
function poll_page_build(&$page) {
$path = drupal_get_path('module', 'poll');
$page['#attached']['css'][$path . '/poll.base.css'] = array('every_page' => TRUE);
$page['#attached']['css'][$path . '/poll.theme.css'] = array('every_page' => TRUE);
}
/**
* Implements hook_block_info().
*/
......
......@@ -4,4 +4,3 @@ package = Core
version = VERSION
core = 8.x
configure = admin/config/search/settings
stylesheets[all][] = search.theme.css
......@@ -42,27 +42,6 @@ function testDefault() {
$this->assertEqual(array(), drupal_add_css(), 'Default CSS is empty.');
}
/**
* Tests that stylesheets in module .info files are loaded.
*/
function testModuleInfo() {
$this->drupalGet('');
// Verify common_test.css in a STYLE media="all" tag.
$elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
':media' => 'all',
':filename' => 'tests/modules/common_test/common_test.css',
));
$this->assertTrue(count($elements), "Stylesheet with media 'all' in module .info file found.");
// Verify common_test.print.css in a STYLE media="print" tag.
$elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
':media' => 'print',
':filename' => 'tests/modules/common_test/common_test.print.css',
));
$this->assertTrue(count($elements), "Stylesheet with media 'print' in module .info file found.");
}
/**
* Tests adding a file stylesheet.
*/
......
......@@ -2377,9 +2377,6 @@ function system_page_build(&$page) {
$page['#attached']['css'][$path . '/system.admin.css'] = array('group' => CSS_SYSTEM);
}
$page['#attached']['css'][$path . '/system.theme.css'] = array('group' => CSS_SYSTEM, 'every_page' => TRUE);
// Add CSS/JS files from module .info files.
system_add_module_assets($page);
}
/**
......@@ -2402,24 +2399,6 @@ function system_get_localized_date_format($languages) {
return array();
}
/**
* Adds CSS and JavaScript files declared in module .info files.
*/
function system_add_module_assets(&$page) {
foreach (system_get_module_info('stylesheets') as $module => $value) {
foreach ($value as $media => $stylesheets) {
foreach ($stylesheets as $stylesheet) {
$page['#attached']['css'][$stylesheet] = array('every_page' => TRUE, 'media' => $media);
}
}
}
foreach (system_get_module_info('scripts') as $module => $scripts) {
foreach ($scripts as $script) {
$page['#attached']['js'][$script] = array('every_page' => TRUE);
}
}
}
/**
* Implements hook_custom_theme().
*/
......@@ -2812,15 +2791,6 @@ function _system_rebuild_module_data() {
// Merge in defaults and save.
$modules[$key]->info = $module->info + $defaults;
// Prefix stylesheets and scripts with module path.
$path = dirname($module->uri);
if (isset($module->info['stylesheets'])) {
$module->info['stylesheets'] = _system_info_add_path($module->info['stylesheets'], $path);
}
if (isset($module->info['scripts'])) {
$module->info['scripts'] = _system_info_add_path($module->info['scripts'], $path);
}
// Installation profiles are hidden by default, unless explicitly specified
// otherwise in the .info file.
if ($key == $profile && !isset($modules[$key]->info['hidden'])) {
......
......@@ -3,6 +3,4 @@ description = "Support module for Common tests."
package = Testing
version = VERSION
core = 8.x
stylesheets[all][] = common_test.css
stylesheets[print][] = common_test.print.css
hidden = TRUE
......@@ -5,4 +5,3 @@ version = VERSION
core = 8.x
required = TRUE
configure = admin/config/people
stylesheets[all][] = user.css
......@@ -111,6 +111,14 @@ function user_theme() {
);
}
/**
* Implements hook_page_build().
*/
function user_page_build(&$page) {
$path = drupal_get_path('module', 'user');
$page['#attached']['css'][$path . '/user.css'] = array('every_page' => TRUE);
}
/**
* Entity URI callback.
*/
......
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