You are here

function emfield_allowed_providers in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 5 emfield.module \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_content_generate in deprecated/emfield-deprecated.inc
Implementation of Devel module's hook_content_generate().
emfield_parse_embed in deprecated/emfield-deprecated.inc
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, which in turn is a help function for all emfields that implement hook_widget(). This creates default widget handling for all the Embedded Media Fields. Helper modules are expected to call this function to…
_emfield_emfield_widget in deprecated/emfield-deprecated.cck.inc
Helper function for emfield_emfield_widget, which in turn is a help function for all emfields that implement hook_widget(). This creates default widget handling for all the Embedded Media Fields. Helper modules are expected to call this function to…

File

deprecated/emfield-deprecated.inc, line 94
Functionality to be deprecated from earlier versions of Embedded Media Field.

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;
}