function geofield_schemaorg_shape in Geofield 7.2
Schema.org format.
Formats shapes for output in metadata using Schema.org format. This is different from the WKT format provided by GeoGenerator, so just use a one off function.
2 calls to geofield_schemaorg_shape()
- geofield_return_schemaorg_shape in ./
geofield.schemaorg.inc - Gets the Schema.org formatted shape value.
- _geofield_item_microdata_propertyvalue in ./
geofield.formatters.inc - Function to return appropriate GeoCoordinates/GeoShape properties.
File
- ./
geofield.schemaorg.inc, line 10
Code
function geofield_schemaorg_shape($item) {
$output = '';
$bottom = $item['bottom'];
$left = $item['left'];
$right = $item['right'];
$top = $item['top'];
switch ($item['geo_type']) {
case 'polygon':
$output = $bottom . ',' . $left . ' ';
$output .= $bottom . ',' . $right . ' ';
$output .= $top . ',' . $right . ' ';
$output .= $top . ',' . $left . ' ';
$output .= $bottom . ',' . $left;
break;
case 'linestring':
$output = $bottom . ',' . $left . ' ';
$output .= $bottom . ',' . $right . ' ';
$output .= $top . ',' . $right . ' ';
$output .= $top . ',' . $left;
break;
}
return $output;
}