diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-06-14 15:41:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-06-14 15:41:03 +0000 |
commit | 9cf21be9949ad70b4fb41eed0d4b8204afead2f8 (patch) | |
tree | c01d1e3cc750c26a541f81a293ea9bcbd64d73a8 /modules/field/field.module | |
parent | f6d56f96c306a9e9ec3202c087321edc39d65b03 (diff) | |
download | brdo-9cf21be9949ad70b4fb41eed0d4b8204afead2f8.tar.gz brdo-9cf21be9949ad70b4fb41eed0d4b8204afead2f8.tar.bz2 |
- Patch #780154 by chx, noahb, dhthwy, pwolanin, aspilicious, jhodgdon, dereine, bjaspan: listing API for field API.
Diffstat (limited to 'modules/field/field.module')
-rw-r--r-- | modules/field/field.module | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/modules/field/field.module b/modules/field/field.module index 25b9c8265..4ef400633 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -102,28 +102,6 @@ define('FIELD_LOAD_CURRENT', 'FIELD_LOAD_CURRENT'); define('FIELD_LOAD_REVISION', 'FIELD_LOAD_REVISION'); /** - * @name Field query flags - * @{ - * Flags for field_attach_query(). - */ - -/** - * Limit argument for field_attach_query() to request all available - * entities instead of a limited number. - */ -define('FIELD_QUERY_NO_LIMIT', 'FIELD_QUERY_NO_LIMIT'); - -/** - * Cursor return value for field_attach_query() to indicate that no - * more data is available. - */ -define('FIELD_QUERY_COMPLETE', 'FIELD_QUERY_COMPLETE'); - -/** - * @} End of "Field query flags". - */ - -/** * Exception class thrown by hook_field_update_forbid(). */ class FieldUpdateForbiddenException extends FieldException {} @@ -877,8 +855,12 @@ function field_get_items($entity_type, $entity, $field_name, $langcode = NULL) { * TRUE if the field has data for any entity; FALSE otherwise. */ function field_has_data($field) { - $results = field_attach_query($field['id'], array(), array('limit' => 1)); - return !empty($results); + $query = new EntityFieldQuery(); + return (bool) $query + ->fieldCondition($field) + ->range(0, 1) + ->count() + ->execute(); } /** |