You are here

function getlocations_get_bundles in Get Locations 7

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

Fetch bundle names for a given module and type

Parameters

array $module module name:

array $type type name:

Return value

array suitable for use in a dropdown.

1 call to getlocations_get_bundles()
getlocations_blocks_block_configure in modules/getlocations_blocks/getlocations_blocks.module
Implements hook_block_configure().

File

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

Code

function getlocations_get_bundles($module = 'getlocations_fields', $type = 'getlocations_fields') {
  $bundles = array();
  $query = db_select('field_config', 'f');
  $query
    ->fields('i', array(
    'bundle',
  ));
  $query
    ->join('field_config_instance', 'i', 'f.id=i.field_id');
  $query
    ->condition('f.module', $module)
    ->condition('f.type', $type)
    ->condition('f.active', 1);
  $rows = $query
    ->execute();
  foreach ($rows as $row) {
    $bundles[$row->bundle] = $row->bundle;
  }
  return $bundles;
}