function media_get_resources in D7 Media 6
Fetch all resources registered and call the specified callback. I
Also add item to the media browser as a horizontal tab.
@TODO Implement admin weighting here somehow.
Parameters
array $registration_ids: Array of registration ids to be loaded.
string $node_type: Drupal node type.
field $field: CCK field name.
int $uid: Drupal {user} id.
Return value
array
1 call to media_get_resources()
- media_build_browser_form in ./media.module 
- Build data for the media browser display.
File
- ./media.module, line 417 
- Media API
Code
function media_get_resources($registration_ids, $node_type, $field, $uid) {
  // Get all the registrations that define the resources.
  $registrations = media_get_registered_modules($registration_ids);
  foreach ($registrations as $id => $registration) {
    // Get the callback function.
    $function = $registration['callbacks']['resource'];
    if (function_exists($function)) {
      // Get the results of the callback function.
      $item = $function($node_type, $field, $uid);
      $tab_name = check_plain(key($item));
      // Add a resource_id to the item.
      $item[$tab_name][key($item[$tab_name])]['resource_id'] = array(
        '#type' => 'value',
        '#value' => $id,
      );
      // Add a resource module to the item so that we don't have to figure it out later
      $item[$tab_name][key($item[$tab_name])]['registered_module'] = array(
        '#type' => 'value',
        '#value' => $registration['module'],
      );
      // Add tabs under the tab name.
      $items[$tab_name][key($item[$tab_name])] = $item[$tab_name][key($item[$tab_name])];
    }
  }
  return $items;
}