Fix error handling.

This commit is contained in:
David Molineus
2017-01-18 17:23:41 +01:00
parent 9880307f6d
commit 7f1c5ea8e4
2 changed files with 4 additions and 3 deletions

View File

@@ -63,13 +63,13 @@ class GeocodeWidget extends \Widget
if ( if (
// See: http://stackoverflow.com/a/18690202 // See: http://stackoverflow.com/a/18690202
!preg_match( !preg_match(
'^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$', '#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
$value $value
) )
) { ) {
$this->addError( $this->addError(
sprintf( sprintf(
$GLOBALS['TL_LANG']['ERR']['leaflet_invalid_coordinate'], $GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'],
$value $value
) )
); );
@@ -92,6 +92,7 @@ class GeocodeWidget extends \Widget
'value' => specialchars($this->value), 'value' => specialchars($this->value),
'class' => $this->strClass ? ' ' . $this->strClass : '', 'class' => $this->strClass ? ' ' . $this->strClass : '',
'id' => $this->strId, 'id' => $this->strId,
'name' => $this->strName,
'attributes' => $this->getAttributes(), 'attributes' => $this->getAttributes(),
'wizard' => $this->wizard, 'wizard' => $this->wizard,
'label' => $this->strLabel 'label' => $this->strLabel

View File

@@ -8,6 +8,6 @@
* *
*/ */
$GLOBALS['TL_LANG']['ERR']['leaflet_invalid_coordinate'] = 'Die angegebenen Koordinaten sind ungültig.'; $GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.';
$GLOBALS['TL_LANG']['MSC']['leafletSearchPositionLabel'] = 'Suchen'; $GLOBALS['TL_LANG']['MSC']['leafletSearchPositionLabel'] = 'Suchen';
$GLOBALS['TL_LANG']['MSC']['leafletApplyPositionLabel'] = 'Übernehmen'; $GLOBALS['TL_LANG']['MSC']['leafletApplyPositionLabel'] = 'Übernehmen';