Commit 0ea4e1c5 authored by Steven Wittens's avatar Steven Wittens

#100563: Conditional loading of (some) module.css files

parent 7b76938b
......@@ -1283,6 +1283,9 @@ function _locale_export_remove_plural($entry) {
* List languages in search result table
*/
function _locale_string_language_list($translation) {
// Add CSS
drupal_add_css(drupal_get_path('module', 'locale') .'/locale.css');
$languages = locale_supported_languages(FALSE, TRUE);
unset($languages['name']['en']);
$output = '';
......
......@@ -97,11 +97,6 @@ function block_menu($may_cache) {
}
}
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'block') .'/block.css');
}
return $items;
}
......@@ -209,6 +204,9 @@ function _block_rehash() {
function block_admin_display($theme = NULL) {
global $theme_key, $custom_theme;
// Add CSS
drupal_add_css(drupal_get_path('module', 'block') .'/block.css');
// If non-default theme configuration has been selected, set the custom theme.
if ($theme) {
$custom_theme = $theme;
......
......@@ -92,11 +92,6 @@ function forum_menu($may_cache) {
'type' => MENU_CALLBACK);
}
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'forum') .'/forum.css');
}
return $items;
}
......
......@@ -28,11 +28,6 @@ function help_menu($may_cache) {
'access' => $admin_access);
}
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'help') .'/help.css');
}
return $items;
}
......@@ -41,6 +36,9 @@ function help_menu($may_cache) {
* Menu callback; prints a page listing a glossary of Drupal terminology.
*/
function help_main() {
// Add CSS
drupal_add_css(drupal_get_path('module', 'help') .'/help.css');
$output = t('
<h2>Help topics</h2>
<p>Help is available on the following items:</p>
......
......@@ -101,10 +101,6 @@ function locale_menu($may_cache) {
'type' => MENU_CALLBACK);
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'locale') .'/locale.css');
if (is_numeric(arg(5))) {
// String related callbacks
$items[] = array('path' => 'admin/settings/locale/string/edit/'. arg(5),
......
......@@ -414,6 +414,8 @@ function profile_admin_overview() {
* Menu callback; display a list of user information.
*/
function profile_browse() {
// Add CSS
drupal_add_css(drupal_get_path('module', 'profile') .'/profile.css');
$name = arg(1);
list(,,$value) = explode('/', $_GET['q'], 3);
......
......@@ -180,11 +180,6 @@ function search_menu($may_cache) {
}
}
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'search') .'/search.css');
}
return $items;
}
......@@ -1080,6 +1075,9 @@ function theme_search_block_form($form) {
* Perform a standard search on the given keys, and return the formatted results.
*/
function search_data($keys = NULL, $type = 'node') {
// Add CSS
drupal_add_css(drupal_get_path('module', 'search') .'/search.css');
if (isset($keys)) {
if (module_hook($type, 'search')) {
$results = module_invoke($type, 'search', 'search', $keys);
......
......@@ -39,10 +39,6 @@ function tracker_menu($may_cache) {
}
}
else {
// Add the CSS for this module
// We put this in !$may_cache so it's only added once per request
drupal_add_css(drupal_get_path('module', 'tracker') .'/tracker.css');
if (arg(0) == 'user' && is_numeric(arg(1))) {
$items[] = array('path' => 'user/'. arg(1) .'/track', 'title' => t('Track'),
'callback' => 'tracker_track_user', 'access' => user_access('access content'),
......@@ -77,6 +73,9 @@ function tracker_track_user() {
* Menu callback. Prints a listing of active nodes on the site.
*/
function tracker_page($uid = 0) {
// Add CSS
drupal_add_css(drupal_get_path('module', 'tracker') .'/tracker.css');
if ($uid) {
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_post DESC';
$sql = db_rewrite_sql($sql);
......
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