function media_internet_get_providers in D7 Media 7.3
Same name and namespace in other branches
- 7.4 modules/media_internet/media_internet.module \media_internet_get_providers()
- 7 modules/media_internet/media_internet.module \media_internet_get_providers()
- 7.2 modules/media_internet/media_internet.module \media_internet_get_providers()
Gets the list of Internet media providers.
Each 'Provider' has a title and a class which can handle saving remote files. Providers are each given a turn at parsing a user-submitted URL or embed code and, if they recognize that it belongs to a service or protocol they support, they store a representation of it as a file object in file_managed.
Return value
array An associative array of provider information keyed by provider name.
2 calls to media_internet_get_providers()
- media_internet_form_file_entity_add_upload_alter in modules/
media_internet/ media_internet.module - Implements hook_form_FORM_ID_alter().
- media_internet_get_provider in modules/
media_internet/ media_internet.module - Finds the appropriate provider for a given URL or embed_string
File
- modules/
media_internet/ media_internet.module, line 74
Code
function media_internet_get_providers() {
$providers =& drupal_static(__FUNCTION__);
if (!isset($providers)) {
foreach (module_implements('media_internet_providers') as $module) {
foreach (module_invoke($module, 'media_internet_providers') as $class => $info) {
$providers[$class] = $info;
// Store the name of the module which declared the provider.
$providers[$class]['module'] = $module;
// Assign a default value to providers which don't specify a weight.
if (!isset($providers[$class]['weight'])) {
$providers[$class]['weight'] = 0;
}
}
}
// Allow modules to alter the list of providers.
drupal_alter('media_internet_providers', $providers);
// Sort the providers by weight.
uasort($providers, 'drupal_sort_weight');
}
return $providers;
}