You are here

function gdpr_consent_get_consent_fields in General Data Protection Regulation 7

Fetches a list of consent fields for an entity.

Parameters

string $entity_type: The entity type to get fields for.

string|null $bundle: (Optional) the bundle to get fields for. If none provided, all bundles will be checked.

Return value

array List of consent field names.

1 call to gdpr_consent_get_consent_fields()
gdpr_consent_field_attach_submit in modules/gdpr_consent/gdpr_consent.module
Implements hook_field_attach_submit().

File

modules/gdpr_consent/gdpr_consent.module, line 480
Contains hook implementations and shared functions.

Code

function gdpr_consent_get_consent_fields($entity_type, $bundle = NULL) {
  $instances = field_info_instances($entity_type, $bundle);
  $fields = array();
  foreach ($instances as $field_name => $instance) {
    $field = field_info_field($field_name);
    if ($field['type'] == 'gdpr_user_consent') {
      $fields[] = $field_name;
    }
  }
  return $fields;
}