From 03668e58520bcb98ec1c28cc61adaa656572e404 Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Wed, 14 Sep 2022 12:15:03 +0200 Subject: [PATCH] Fix compatibility with Contao 5 --- src/Widget/GeocodeWidget.php | 10 +++++++--- src/Widget/RadiusWidget.php | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Widget/GeocodeWidget.php b/src/Widget/GeocodeWidget.php index 2d6ba08..5a91d9d 100644 --- a/src/Widget/GeocodeWidget.php +++ b/src/Widget/GeocodeWidget.php @@ -12,13 +12,17 @@ namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget; +use Contao\BackendTemplate; +use Contao\StringUtil; +use Contao\Widget; + /** * Class GeocodeWidget * * @property int size * @property bool multiple */ -class GeocodeWidget extends \Widget +class GeocodeWidget extends Widget { /** * Submit user input. @@ -111,12 +115,12 @@ class GeocodeWidget extends \Widget $buffer = ''; for ($index = 0; $index < $this->size; $index++) { - $template = new \BackendTemplate($this->widgetTemplate); + $template = new BackendTemplate($this->widgetTemplate); $template->setData( [ 'wrapperClass' => $wrapperClass, 'widget' => $this, - 'value' => \StringUtil::specialchars($this->value[$index]), + 'value' => StringUtil::specialchars($this->value[$index]), 'class' => $this->strClass ? ' ' . $this->strClass : '', 'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''), 'name' => $this->strName . (($this->size > 1) ? '[]' : ''), diff --git a/src/Widget/RadiusWidget.php b/src/Widget/RadiusWidget.php index c6bf7e2..58ed85f 100644 --- a/src/Widget/RadiusWidget.php +++ b/src/Widget/RadiusWidget.php @@ -13,6 +13,7 @@ namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget; use Contao\BackendTemplate; +use Contao\StringUtil; use Contao\TextField; /** @@ -66,7 +67,7 @@ class RadiusWidget extends TextField [ 'wrapperClass' => trim($wrapperClass), 'widget' => $this, - 'value' => \StringUtil::specialchars($this->value[$index]), + 'value' => StringUtil::specialchars($this->value[$index]), 'class' => $this->strClass ? ' ' . $this->strClass : '', 'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''), 'name' => $this->strName . (($this->size > 1) ? '[]' : ''),