Commit 000d4096 authored by Liam Morland's avatar Liam Morland
Browse files

RT#977961/ISTWCMS-3157: Add typeof attribute to location fields

The typeof attribute must accompany the property attribute and
property="schema:location" must not be nested. Remove the nested version
from the template.
parent 982f6c0f
...@@ -679,16 +679,14 @@ function uw_ct_event_field_default_field_instances() { ...@@ -679,16 +679,14 @@ function uw_ct_event_field_default_field_instances() {
'settings' => array( 'settings' => array(
'address' => array( 'address' => array(
'show' => 1, 'show' => 1,
'text' => '<div property="schema:location" typeof="schema:Place"> 'text' => '<span property="schema:name">[node:field_event_location:name:0]</span>
<span property="schema:name">[node:field_event_location:name:0]</span>
<div property="schema:address" typeof="schema:PostalAddress"> <div property="schema:address" typeof="schema:PostalAddress">
<span property="schema:streetAddress">[node:field_event_location:additional:0]<br>[node:field_event_location:street:0]</span><br> <span property="schema:streetAddress">[node:field_event_location:additional:0]<br>[node:field_event_location:street:0]</span><br>
<span property="schema:addressLocality">[node:field_event_location:city:0]</span>, <span property="schema:addressLocality">[node:field_event_location:city:0]</span>,
<span property="schema:addressRegion">[node:field_event_location:province:0]</span> <span property="schema:addressRegion">[node:field_event_location:province:0]</span>
<span property="schema:postalCode">[node:field_event_location:postal_code:0]</span><br> <span property="schema:postalCode">[node:field_event_location:postal_code:0]</span><br>
<span property="schema:addressCountry">[node:field_event_location:country_name:0]</span><br> <span property="schema:addressCountry">[node:field_event_location:country_name:0]</span><br>
</div> </div>',
</div>',
), ),
'height' => 300, 'height' => 300,
'icon' => array( 'icon' => array(
......
...@@ -1037,6 +1037,17 @@ function uw_ct_event_theme_registry_alter(&$theme_registry) { ...@@ -1037,6 +1037,17 @@ function uw_ct_event_theme_registry_alter(&$theme_registry) {
); );
} }
/**
* Implements hook_preprocess_HOOK().
*
* Add typeof="schema:Place" to fields with property="schema:location".
*/
function uw_ct_event_preprocess_field(&$variables) {
if (isset($variables['item_attributes_array'][0]['property'][0]) && $variables['item_attributes_array'][0]['property'][0] === 'schema:location' && !isset($variables['item_attributes_array'][0]['typeof'][0])) {
$variables['item_attributes_array'][0]['typeof'][0] = 'schema:Place';
}
}
/** /**
* Implements hook_theme(). * Implements hook_theme().
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment