You are here

function getlocations_get_supported_entities in Get Locations 7

Same name and namespace in other branches
  1. 7.2 getlocations.module \getlocations_get_supported_entities()

Function to collect entities being used by the given module

Parameters

string $module:

Return value

Returns array of entity names or FALSE

2 calls to getlocations_get_supported_entities()
getlocations_fields_tokens in modules/getlocations_fields/getlocations_fields.functions.inc
Implements hook_tokens().
getlocations_fields_token_info in modules/getlocations_fields/getlocations_fields.functions.inc
Implements hook_token_info(). derived from location_cck module

File

./getlocations.module, line 2524
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_get_supported_entities($module = FALSE) {
  if (!$module) {
    $module = getlocations_get_current_supported_module();
  }
  if ($module) {
    $query = db_select('field_config', 'f');
    $query
      ->fields('i', array(
      'entity_type',
    ));
    $query
      ->join('field_config_instance', 'i', 'f.id = i.field_id');
    $query
      ->condition('f.module', $module)
      ->condition('f.active', 1);
    $rows = $query
      ->execute();
    $data = array();
    foreach ($rows as $row) {
      $data[$row->entity_type] = $row->entity_type;
    }
    return count($data) ? array_keys($data) : FALSE;
  }
  return FALSE;
}