You are here

function _advanced_forum_add_files in Advanced Forum 6.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \_advanced_forum_add_files()
  2. 6 advanced_forum.module \_advanced_forum_add_files()
  3. 7.2 includes/style.inc \_advanced_forum_add_files()

Adds extra files needed for styling. This is currently just CSS files but was made generic to allow adding javascript in the future.

19 calls to _advanced_forum_add_files()
advanced_forum_forum_legend_content_type_render in plugins/content_types/forum_legend.inc
Render the content.
advanced_forum_forum_list_content_type_render in plugins/content_types/forum_list.inc
Render the content.
advanced_forum_forum_mark_read_content_type_render in plugins/content_types/forum_mark_read.inc
Render the content.
advanced_forum_forum_most_active_poster_content_type_render in plugins/content_types/forum_most_active_poster.inc
Render the content.
advanced_forum_forum_node_create_list_content_type_render in plugins/content_types/forum_node_create_list.inc
Render the content.

... See full list

File

includes/style.inc, line 313
Functions relating to the style system, not including core hooks and preprocess / theme functions.

Code

function _advanced_forum_add_files() {

  // This could get called more than once on a page and we only need to do it once.
  static $added;
  if (empty($added)) {
    $added = TRUE;
    $lineage = advanced_forum_style_lineage();
    $lineage = array_reverse($lineage, TRUE);
    $theme_path = advanced_forum_path_to_theme();
    foreach (array(
      'structure.css',
      'style.css',
      'images.css',
    ) as $css_type) {
      $css_file = "{$theme_path}/advanced_forum.{$css_type}";
      if (file_exists($css_file)) {

        // CSS files with no style name in the theme directory trump all
        // to provide a theme specific style override.
        drupal_add_css($css_file);
      }
      else {

        // For each style from the current style on up through each parent
        // style, look for the style specific CSS file first in the active
        // theme and then in the style directory.
        foreach ($lineage as $key => $path) {
          $css_file = "/advanced_forum.{$key}.{$css_type}";
          if (file_exists("{$theme_path}/{$css_file}")) {

            // If the style specific file is in the theme, use that.
            drupal_add_css("{$theme_path}/{$css_file}");
          }
          elseif (file_exists("{$path}/{$css_file}")) {

            // Otherwise look in the style for it.
            drupal_add_css("{$path}" . "{$css_file}");
          }
        }
      }
    }
    advanced_forum_load_style_includes();
  }
}