You are here

function schemaorg_contrib_field_preprocess_addressfield in Schema.org 7

@file Addressfield field formatter specific code for schema.org.

1 call to schemaorg_contrib_field_preprocess_addressfield()
schemaorg_contrib_preprocess_field in modules/schemaorg_contrib/schemaorg_contrib.module
Implements MODULE_preprocess_HOOK().

File

modules/schemaorg_contrib/schemaorg_contrib.addressfield.inc, line 8
Addressfield field formatter specific code for schema.org.

Code

function schemaorg_contrib_field_preprocess_addressfield(&$variables) {
  $element = $variables['element'];
  foreach ($element['#items'] as $delta => $item) {

    // Add typeof attribute to the field item wrapper.
    $variables['item_attributes_array'][$delta]['typeof'] = 'schema:PostalAddress';

    // Inject property RDFa attribute on each element of the address field
    // formatter output.
    _schemaorg_contrib_addressfield_add_attributes($variables['items'][$delta], $element['#items'][$delta]);
  }
}