You are here

function filefield_sources_includes in FileField Sources 7

Same name and namespace in other branches
  1. 6 filefield_sources.module \filefield_sources_includes()

Load all the potential sources.

1 call to filefield_sources_includes()
filefield_sources_invoke_all in ./filefield_sources.module
Call all FileField Source hooks stored in the available include files.

File

./filefield_sources.module, line 398
Extend FileField to allow files from multiple sources.

Code

function filefield_sources_includes($include = TRUE, $enabled_only = TRUE) {
  if ($enabled_only) {
    $enabled_includes = variable_get('filefield_sources', filefield_sources_includes(FALSE, FALSE));
  }
  $includes = array();
  $directory = drupal_get_path('module', 'filefield_sources') . '/sources';
  foreach (file_scan_directory($directory, '/\\.inc$/') as $file) {
    if (!$enabled_only || in_array($file->name, $enabled_includes)) {
      $includes[] = $file->name;
      if ($include) {
        include_once DRUPAL_ROOT . '/' . $file->uri;
      }
    }
  }
  return $includes;
}