Fix compatibility with Contao 5

This commit is contained in:
Kamil Kuzminski
2022-09-14 12:15:03 +02:00
parent c7e65d2db5
commit 03668e5852
2 changed files with 9 additions and 4 deletions

View File

@@ -12,13 +12,17 @@
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget; namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget;
use Contao\BackendTemplate;
use Contao\StringUtil;
use Contao\Widget;
/** /**
* Class GeocodeWidget * Class GeocodeWidget
* *
* @property int size * @property int size
* @property bool multiple * @property bool multiple
*/ */
class GeocodeWidget extends \Widget class GeocodeWidget extends Widget
{ {
/** /**
* Submit user input. * Submit user input.
@@ -111,12 +115,12 @@ class GeocodeWidget extends \Widget
$buffer = ''; $buffer = '';
for ($index = 0; $index < $this->size; $index++) { for ($index = 0; $index < $this->size; $index++) {
$template = new \BackendTemplate($this->widgetTemplate); $template = new BackendTemplate($this->widgetTemplate);
$template->setData( $template->setData(
[ [
'wrapperClass' => $wrapperClass, 'wrapperClass' => $wrapperClass,
'widget' => $this, 'widget' => $this,
'value' => \StringUtil::specialchars($this->value[$index]), 'value' => StringUtil::specialchars($this->value[$index]),
'class' => $this->strClass ? ' ' . $this->strClass : '', 'class' => $this->strClass ? ' ' . $this->strClass : '',
'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''), 'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''),
'name' => $this->strName . (($this->size > 1) ? '[]' : ''), 'name' => $this->strName . (($this->size > 1) ? '[]' : ''),

View File

@@ -13,6 +13,7 @@
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget; namespace Netzmacht\Contao\Leaflet\GeocodeWidget\Widget;
use Contao\BackendTemplate; use Contao\BackendTemplate;
use Contao\StringUtil;
use Contao\TextField; use Contao\TextField;
/** /**
@@ -66,7 +67,7 @@ class RadiusWidget extends TextField
[ [
'wrapperClass' => trim($wrapperClass), 'wrapperClass' => trim($wrapperClass),
'widget' => $this, 'widget' => $this,
'value' => \StringUtil::specialchars($this->value[$index]), 'value' => StringUtil::specialchars($this->value[$index]),
'class' => $this->strClass ? ' ' . $this->strClass : '', 'class' => $this->strClass ? ' ' . $this->strClass : '',
'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''), 'id' => $this->strId . (($this->size > 1) ? '_' . $index : ''),
'name' => $this->strName . (($this->size > 1) ? '[]' : ''), 'name' => $this->strName . (($this->size > 1) ? '[]' : ''),