You are here

function emfield_allowed_providers in Embedded Media Field 5

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

return a list of providers allowed for a specific field

4 calls to emfield_allowed_providers()
emfield_emfield_widget in ./emfield.module
emfield_parse_embed in ./emfield.module
This will parse the url or embedded code pasted by the node submitter. returns either an empty array (if no match), or an array of provider and value.
emimport_import in contrib/emimport/emimport.module
emimport_types_allowing_import in contrib/emimport/emimport.module
this returns a list of content types that are allowed to import media sets, and that have providers allowing that

File

./emfield.module, line 197

Code

function emfield_allowed_providers($field, $module) {

  //   $module = $field['widget']['helper_module'];
  $allowed_providers = emfield_system_list($module);
  $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 &= !$field['widget']['providers'][$test->name];
    }
  }
  if (!$allow_all) {
    foreach ($allowed_providers as $test) {
      if (!$field['widget']['providers'][$test->name]) {
        unset($allowed_providers[$test->name]);
      }
    }
  }
  return $allowed_providers;
}