You are here

function commerce_registration_registration_field_instance in Commerce Registration 7.3

Helper function that returns the registration field name on the given entity.

Parameters

string $entity_type The type of entity.:

object $entity The entity object.:

Return value

The registration field name, or FALSE if none exist on the entity.

3 calls to commerce_registration_registration_field_instance()
commerce_registration_entity_registration_form_submit in ./commerce_registration.module
Submit handler to save registration settings.
commerce_registration_modify_entity_registration_form in ./commerce_registration.module
Helper function that adds registration settings to the form.
commerce_registration_registration_settings_tab in includes/commerce_registration.admin.inc

File

./commerce_registration.module, line 346
Commerce Registration module code.

Code

function commerce_registration_registration_field_instance($entity_type, $entity) {
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  $fields = field_read_fields(array(
    'type' => 'registration',
  ));
  foreach ($fields as $field) {
    $options = array(
      'field_name' => $field['field_name'],
      'entity_type' => $entity_type,
      'bundle' => $bundle,
    );
    $instance = reset(field_read_instances($options));
    if (count($instance) > 0) {
      return $instance;
    }
  }
  return FALSE;
}