You are here

function author_pane_include in Author Pane 6

Same name and namespace in other branches
  1. 5 author_pane.module \author_pane_include()
  2. 6.2 author_pane.module \author_pane_include()
  3. 7.2 author_pane.module \author_pane_include()

Load advanced forum files on behalf of modules.

This function, taken from the views include system, allows us to include an appropriately named include file bundled with any enabled module. It is currently used only to load the MODULE.author-pane.inc files which allow other modules to add to the author pane.

2 calls to author_pane_include()
author_pane_theme in ./author_pane.module
Implementation of hook_theme().
template_preprocess_author_pane in ./author_pane.module
Preprocesses template variables for the author info template.

File

./author_pane.module, line 123
Gathers information from user related contrib modules into one template.

Code

function author_pane_include($file) {
  $includes = array();
  $author_pane_path = drupal_get_path('module', 'author_pane') . '/modules';
  foreach (module_list() as $module) {
    $module_path = drupal_get_path('module', $module);
    if (file_exists("{$module_path}/{$module}.{$file}")) {
      $includes[] = "./{$module_path}/{$module}.{$file}";
    }
    else {
      if (file_exists("{$module_path}/includes/{$module}.{$file}")) {
        $includes[] = "./{$module_path}/includes/{$module}.{$file}";
      }
      else {
        if (file_exists("{$author_pane_path}/{$module}.{$file}")) {
          $includes[] = "./{$author_pane_path}/{$module}.{$file}";
        }
      }
    }
  }
  if (!empty($includes)) {
    foreach ($includes as $include) {
      require_once $include;
    }
  }
}