You are here

function author_pane_include in Author Pane 5

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

Load author pane 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.

1 call to author_pane_include()
theme_author_pane in ./author_pane.module
Theme function wrapper around D6 style preprocess function.

File

./author_pane.module, line 100

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;
    }
  }
}