You are here

function emfield_system_list in Embedded Media Field 6

Same name and namespace in other branches
  1. 5 emfield.module \emfield_system_list()
  2. 6.3 deprecated/emfield-deprecated.inc \emfield_system_list()
  3. 6.2 emfield.module \emfield_system_list()

Return an array of installed .inc files and/or loads them upon request. This routine is modeled after drupal_system_listing() (and also depends on it). It's major difference, however, is that it loads .inc files by default.

Parameters

$provider: Optional; name of the passed $provider to find (e.g. "youtube", "google", etc.).

$load: Defaults to TRUE; whether to include matching files into memory.

Return value

An array of file objects optionally matching $provider.

14 calls to emfield_system_list()
emfield_allowed_providers in ./emfield.module
Return a list of providers allowed for a specific field.
emfield_include_invoke in ./emfield.module
Invoke hook in a particular include.
emfield_provider_menus in ./emfield.module
emfield_provider_themes in ./emfield.module
emfield_settings in ./emfield.admin.inc
Callback for admin/content/emfield.

... See full list

File

./emfield.module, line 522
Embedded Media Field is a CCK-based framework for 3rd party media files.

Code

function emfield_system_list($module, $provider = NULL, $load = TRUE) {

  // Maintain a static list of providers.
  static $files;
  if (!isset($files)) {

    // Initialize our static variable.
    $files = array();
  }
  if (!isset($files[$module])) {

    // Initialize the file listing for the invoking module.
    $files[$module] = array();
  }
  if (!isset($provider) && empty($files[$module]) || isset($provider) && !isset($files[$module][$provider])) {

    // First find any providers external to the emfield set of modules.
    $override_files = module_invoke_all('emfield_providers', $module, $provider);

    // Next get the default providers. Note this is being phased out in v2.
    $provider_files = drupal_system_listing("{$provider}\\.inc\$", drupal_get_path('module', $module) . "/providers", 'name', 0);

    // Merge the files, allowing provider overrides.
    $provider_files = array_merge($provider_files, $override_files);
    $files[$module] = array_merge($files[$module], $provider_files);

    // Sort the providers alphabetically.
    ksort($files[$module]);
  }
  if ($load) {
    if (isset($provider) && isset($files[$module][$provider])) {
      emfield_include_list($files[$module][$provider]);
    }
    else {
      foreach ($files[$module] as $key => $file) {
        emfield_include_list($file);
      }
    }
  }
  if (isset($provider)) {
    return $files[$module][$provider];
  }
  return $files[$module];
}