You are here

function gdpr_tasks_sars_callback_address_field in General Data Protection Regulation 7

GDPR SARs render callback for address fields.

1 string reference to 'gdpr_tasks_sars_callback_address_field'
gdpr_tasks_field_metatdata_property_info_alter in modules/gdpr_tasks/gdpr_tasks.module
Field entity metadata property callback.

File

modules/gdpr_tasks/gdpr_tasks.module, line 915
Module file for the GDPR Tasks module.

Code

function gdpr_tasks_sars_callback_address_field(EntityMetadataWrapper $value) {
  $components = array();
  $address = $value
    ->value();
  $available = array(
    'name_line',
    'first_name',
    'last_name',
    'organisation_name',
    'thoroughfare',
    'premise',
    'locality',
    'administrative_area',
    'postal_code',
    'country',
  );
  foreach ($available as $component) {
    if (!empty($address[$component])) {
      $components[] = $address[$component];
    }
  }
  return implode(', ', $components);
}