You are here

function getlocations_check_entity_type in Get Locations 7.2

Same name and namespace in other branches
  1. 7 getlocations.module \getlocations_check_entity_type()

Function is an entity_type location enabled?

Parameters

string $entity_type:

string $bundle:

Return value

Returns boolean

9 calls to getlocations_check_entity_type()
getlocations_box in ./getlocations.module
Function for colorbox and suchlike
getlocations_check_vocabulary in ./getlocations.module
Function to check a vocabulary
getlocations_entity_type_load in ./getlocations.module
sanity check on entity type
getlocations_leaflet_plugin_style::options_form in modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc
Options form
getlocations_leaflet_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module

... See full list

File

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

Code

function getlocations_check_entity_type($entity_type = '', $bundle = '') {
  if ($entity_type == 'term') {
    $entity_type = 'taxonomy_term';
  }
  if ($module = getlocations_get_current_supported_module()) {
    $query = db_select('field_config', 'f');
    $query
      ->fields('f', array(
      'id',
    ));
    $query
      ->join('field_config_instance', 'i', 'f.id=i.field_id');
    $query
      ->condition('f.module', $module);
    if ($entity_type) {
      $query
        ->condition('i.entity_type', $entity_type);
    }
    if ($bundle) {
      $query
        ->condition('i.bundle', $bundle);
    }
    $query
      ->condition('f.active', 1);
    $number_of_rows = $query
      ->countQuery()
      ->execute()
      ->fetchField();
    if ($number_of_rows) {
      return TRUE;
    }
  }
  return FALSE;
}