You are here

function _scald_types in Scald: Media Management made easy 6

Get the available Scald Unified Types

This function determines and returns a structured array specifying all the currently provided Scald Unified Types. The Scald Unified Types array has the following format: array( 'type-slug' => array( 'title' => 'Plain-text title', 'providers' => array( 'provider', ... ), ... );

Return value

The Scald Unified Types array

4 calls to _scald_types()
atom_reference_field_settings in atom_reference/atom_reference.module
Implements hook_field_settings().
scald_config_rebuild in ./scald.module
Rebuild the Scald Configuration Object & other key configuration variables.
scald_views_handler_filter_atom_provider::get_value_options in includes/scald_views_handler_filter_atom_provider.inc
scald_views_handler_filter_atom_type::get_value_options in includes/scald_views_handler_filter_atom_type.inc

File

./scald.module, line 560

Code

function _scald_types() {
  $scald_types = array();
  $types_results = db_query('SELECT type, title, provider FROM {scald_types}');
  while ($type_raw = db_fetch_array($types_results)) {
    $scald_types[$type_raw['type']] = array(
      'provider' => $type_raw['provider'],
      'title' => $type_raw['title'],
      'atom_providers' => array(),
    );
  }

  // Ensure only a single entry is recorded for each type/provider mapping to
  //  avoid unnecessary executions of hooks.
  $providers_results = db_query('SELECT DISTINCT type, provider FROM {scald_atom_providers}');
  while ($provider_raw = db_fetch_array($providers_results)) {
    $scald_types[$provider_raw['type']]['atom_providers'][] = $provider_raw['provider'];
  }
  return $scald_types;
}