Add load callback.

This commit is contained in:
David Molineus
2015-01-27 00:14:27 +01:00
parent 43a378bed6
commit a399004988
3 changed files with 48 additions and 8 deletions

View File

@@ -82,6 +82,39 @@ class Marker
->set($combined)
->execute($dataContainer->id);
return $value;
return null;
}
/**
* Load the coordinates.
*
* @param string $value The raw data.
* @param \DataContainer $dataContainer The data container driver.
*
* @return string
*/
public function loadCoordinates($value, $dataContainer)
{
$result = \Database::getInstance()
->prepare('SELECT latitude, longitude, altitude FROM tl_leaflet_marker WHERE id=?')
->execute($dataContainer->id);
if ($result->numRows) {
$buffer = $result->latitude;
if ($buffer && $result->longitude) {
$buffer .= ',' . $result->longitude;
} else {
return $buffer;
}
if ($buffer && $result->altitude) {
$buffer .= ',' . $result->longitude;
}
return $buffer;
}
return '';
}
}