diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 2a16bc1..b076cf2 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -265,18 +265,12 @@ function field_info_storage_types($storage_type = NULL) { * which this field belongs, keyed by entity type. * * @see field_info_field_map() + * + * @deprecated as of Drupal 8.0. Use + * Field::fieldInfo()->getActiveFields() instead. */ function field_info_fields() { - $info = Field::fieldInfo()->getFields(); - - $fields = array(); - foreach ($info as $key => $field) { - if (!$field['deleted']) { - $fields[$field['field_name']] = $field; - } - } - - return $fields; + return Field::fieldInfo()->getActiveFields(); } /** @@ -470,6 +464,9 @@ function field_info_instance($entity_type, $field_name, $bundle_name) { * * @return * The array of pseudo-field elements in the bundle. + * + * @deprecated as of Drupal 8.0. Use + * Field::fieldInfo()->getBundleExtraFields($entity_type, $bundle). */ function field_info_extra_fields($entity_type, $bundle, $context) { $info = Field::fieldInfo()->getBundleExtraFields($entity_type, $bundle); diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php index 349872e..7118132 100644 --- a/core/modules/field/lib/Drupal/field/FieldInfo.php +++ b/core/modules/field/lib/Drupal/field/FieldInfo.php @@ -243,6 +243,30 @@ public function getFields() { } /** + * Returns all active fields, excluding deleted ones. + * + * To mirror functionality of the deprecated field_info_fields() by excluding + * deleted fields. + * + * TODO - remove this method when the disabled modules patch is implemented. + * + * @return + * An array of field definitions, keyed by field ID, excluding deleted ones. + */ + public function getActiveFields() { + $info = $this->getFields(); + + $fields = array(); + foreach ($info as $key => $field) { + if (!$field['deleted']) { + $fields[$field['field_name']] = $field; + } + } + + return $fields; + } + + /** * Retrieves all active, non-deleted instances definitions. * * @param $entity_type