diff --git a/API.txt b/API.txt index d1eb582aa23f4593c02c8b2cd8560d49a7ce27b3..43056722485ba36ec747d83872deab9d388f859b 100644 --- a/API.txt +++ b/API.txt @@ -1,13 +1,16 @@ -Current API Version: 2.0.4 +Current API Version: 2.0.5 Please note that the API version is an internal number and does not match release numbers. It is entirely possible that releases will not increase the API version number, and increasing this number too often would burden contrib module maintainers who need to keep up with API changes. This file contains a log of changes to the API. +API Version 2.0.5 + Introduce ctools_fields_get_fields_by_type(). + API Version 2.0.4 Introduce ctools_form_include_file() API Version 2.0.3 - Introduce ctools_field_invoke_field() and + Introduce ctools_field_invoke_field() and ctools_field_invoke_field_default(). API Version 2.0.2 Introduce ctools_export_crud_load_multiple() and 'load multiple callback' to diff --git a/ctools.module b/ctools.module index eca75f2b09bfea01b7ca2489b8b7ad51425ffe95..b3acdf4748a849396d9d28380c1621ed3b545c3b 100644 --- a/ctools.module +++ b/ctools.module @@ -9,7 +9,7 @@ * must be implemented in the module file. */ -define('CTOOLS_API_VERSION', '2.0.4'); +define('CTOOLS_API_VERSION', '2.0.5'); /** * Test the CTools API version. diff --git a/includes/fields.inc b/includes/fields.inc index 5e3d0e19914e85ae05a7d626763a227ca35854d5..9b08f3870642adf92e8727e7854dbbc5696cef29 100644 --- a/includes/fields.inc +++ b/includes/fields.inc @@ -110,7 +110,7 @@ function ctools_fields_get_field_formatter_settings_form($field, $formatter_type '#default_value' => $conf['delta_reversed'], '#description' => t('(start from last values)'), ); - } + } } /** @@ -287,3 +287,22 @@ function ctools_field_invoke_field_default($field_name, $op, $entity_type, $enti $options['default'] = TRUE; return ctools_field_invoke_field($field_name, $op, $entity_type, $entity, $a, $b, $options); } + +/** + * Returns a list of field definitions of a specified type. + * + * @param string $field_type + * A field type name; e.g. 'text' or 'date'. + * + * @return array + * An array of field definitions of the specified type, keyed by field name. + */ +function ctools_fields_get_fields_by_type($field_type) { + $fields = array(); + foreach (field_info_fields() as $field_name => $field_info) { + if ($field_info['type'] == $field_type) { + $fields[$field_name] = $field_info; + } + } + return $fields; +}