function structured_data_get_local_info in Structured Data (JSON+LD Rich Snippets) 7
Gets the local business data.
Return value
(array) Data matching schema.org definition for address.
1 call to structured_data_get_local_info()
- structured_data_preprocess_html in ./
structured_data.module - Implements template_preprocess_html().
File
- ./
structured_data.module, line 139 - Annotate your content to generate Rich Search Snippets.
Code
function structured_data_get_local_info() {
$data = array(
'address' => array(
'@type' => 'PostalAddress',
),
);
// Address parts are grouped together.
if ($address = variable_get('structured_data_address', FALSE)) {
$data['address']['streetAddress'] = $address;
}
if ($city = variable_get('structured_data_city', FALSE)) {
$data['address']['addressLocality'] = $city;
}
if ($state = variable_get('structured_data_state', FALSE)) {
$data['address']['addressRegion'] = $state;
}
if ($zip = variable_get('structured_data_zip', FALSE)) {
$data['address']['postalCode'] = $zip;
}
return $data;
}