You are here

function author_pane_include in Author Pane 7.2

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. 6 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.

2 calls to author_pane_include()
author_pane_theme in ./author_pane.module
Implements hook_theme().
template_preprocess_author_pane in ./author_pane.module
Process variables for author-pane.tpl.php.

File

./author_pane.module, line 139
Gathers information from user related 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}";
    }
    elseif (file_exists("{$module_path}/includes/{$module}.{$file}")) {
      $includes[] = "./{$module_path}/includes/{$module}.{$file}";
    }
    elseif (file_exists("{$author_pane_path}/{$module}.{$file}")) {
      $includes[] = "./{$author_pane_path}/{$module}.{$file}";
    }
  }
  if (!empty($includes)) {
    foreach ($includes as $include) {
      require_once DRUPAL_ROOT . '/' . $include;
    }
  }
}