function emfield_allowed_providers in Embedded Media Field 6.2
Same name and namespace in other branches
- 5 emfield.module \emfield_allowed_providers()
- 6.3 deprecated/emfield-deprecated.inc \emfield_allowed_providers()
- 6 emfield.module \emfield_allowed_providers()
Return a list of providers allowed for a specific field.
3 calls to emfield_allowed_providers()
- emfield_content_generate in ./
emfield.module - Implementation of Devel module's hook_content_generate().
- emfield_parse_embed in ./
emfield.module - This will parse the url or embedded code pasted by the node submitter.
- _emfield_emfield_widget in ./
emfield.cck.inc - Helper function for emfield_emfield_widget.
File
- ./
emfield.module, line 94 - Embedded Media Field is a CCK-based framework for 3rd party media files.
Code
function emfield_allowed_providers($field, $module) {
$allowed_providers = emfield_system_list($module);
// $field sometimes is the whole $field and sometimes just the $widget,
// depending on where it is called from, so check which one we have.
$providers = isset($field['widget']['providers']) ? $field['widget']['providers'] : (isset($field['providers']) ? $field['providers'] : array());
$allow_all = TRUE;
foreach ($allowed_providers as $test) {
if (!variable_get('emfield_' . $module . '_allow_' . $test->name, TRUE)) {
unset($allowed_providers[$test->name]);
}
else {
$allow_all &= empty($providers[$test->name]);
}
}
if (!$allow_all) {
foreach ($allowed_providers as $test) {
if (empty($providers[$test->name])) {
unset($allowed_providers[$test->name]);
}
}
}
return $allowed_providers;
}