You are here

function commerce_info_fields in Commerce Core 7

Finds all fields of a particular field type.

Parameters

$field_type: The type of field to search for.

$entity_type: Optional entity type to restrict the search to.

Return value

An array of the matching fields keyed by the field name.

16 calls to commerce_info_fields()
CommerceLineItemEntityController::delete in modules/line_item/includes/commerce_line_item.controller.inc
Delete permanently saved line items.
commerce_customer_commerce_customer_profile_delete in modules/customer/commerce_customer.module
Implements hook_commerce_customer_profile_delete().
commerce_customer_field_widget_form in modules/customer/commerce_customer.module
Implements hook_field_widget_form().
commerce_customer_profile_pane_checkout_form in modules/customer/includes/commerce_customer.checkout_pane.inc
Checkout pane callback: returns a customer profile edit form.
commerce_customer_profile_pane_settings_form in modules/customer/includes/commerce_customer.checkout_pane.inc
Checkout pane callback: returns the customer profile pane's settings form.

... See full list

File

./commerce.module, line 94
Defines features and functions common to the Commerce modules.

Code

function commerce_info_fields($field_type, $entity_type = NULL) {
  $fields = array();

  // Loop through the fields looking for any fields of the specified type.
  foreach (field_info_field_map() as $field_name => $field_stub) {
    if ($field_stub['type'] == $field_type) {

      // Add this field to the return array if no entity type was specified or
      // if the specified type exists in the field's bundles array.
      if (empty($entity_type) || array_key_exists($entity_type, $field_stub['bundles'])) {
        $field = field_info_field($field_name);
        $fields[$field_name] = $field;
      }
    }
  }
  return $fields;
}