You are here

function _wsfields_storage_entity_has_wsfields in Web Service Data 7

Returns whether the entity_type has a wsfield attached to it

1 call to _wsfields_storage_entity_has_wsfields()
wsfields_storage_entity_has_wsfields in modules/wsfields_storage/wsfields_storage.module
Returns whether the entity_type has a wsfield attached to it and cache the result

File

modules/wsfields_storage/wsfields_storage.module, line 70
Storage controller definitions

Code

function _wsfields_storage_entity_has_wsfields($entity_type) {
  $fields = field_info_fields();
  $wsfields = array();
  foreach ($fields as $key => $field) {
    if ($field['storage']['type'] == 'wsfields_storage') {
      $wsfields[$key] = $field;
    }
  }
  $instances = field_info_instances($entity_type);
  foreach ($instances as $instance) {
    foreach ($instance as $field) {
      if (isset($wsfields[$field['field_name']])) {
        return TRUE;
      }
    }
  }
  return FALSE;
}