You are here

function commerce_physical_entity_weight_field_name in Commerce Physical Product 7

Determines the weight field to use for a given entity.

Parameters

string $entity_type: The type of entity passed to the function.

object $entity: The actual entity whose weight field name should be determined.

Return value

string The name of the field to use on the entity to find a weight value or NULL if none was found.

1 call to commerce_physical_entity_weight_field_name()
commerce_physical_product_line_item_weight in ./commerce_physical.module
Determines the weight to use for a product line item on an order.

File

./commerce_physical.module, line 21
API for working with physical product types in Drupal Commerce.

Code

function commerce_physical_entity_weight_field_name($entity_type, $entity) {
  $field_name = commerce_physical_entity_field_name($entity_type, $entity, 'physical_weight');

  // Allow other modules to specify a different field name.
  drupal_alter('commerce_physical_entity_weight_field_name', $field_name, $entity_type, $entity);
  return $field_name;
}