You are here

function panels_load_includes in Panels 5

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_load_includes()
  2. 6.2 includes/plugins.inc \panels_load_includes()
2 calls to panels_load_includes()
panels_get_content_types in ./panels.module
panels_get_layouts in ./panels.module

File

./panels.module, line 799

Code

function panels_load_includes($directory, $callback) {

  // Load all our module 'on behalfs'.
  $path = drupal_get_path('module', 'panels') . '/' . $directory;
  $files = drupal_system_listing('.inc$', $path, 'name', 0);
  foreach ($files as $file) {
    require_once './' . $file->filename;
  }
  $output = module_invoke_all($callback);
  foreach ($files as $file) {
    $function = 'panels_' . $file->name . '_' . $callback;
    if (function_exists($function)) {
      $result = $function();
      if (isset($result) && is_array($result)) {
        $output = array_merge($output, $result);
      }
    }
  }
  return $output;
}