Skip to content

Commit

Permalink
Check for known options in serialized values of a widget
Browse files Browse the repository at this point in the history
  • Loading branch information
martinschumann committed Sep 29, 2020
1 parent aea1435 commit a392eea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Resources/contao/library/Contao/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -1327,14 +1327,15 @@ public static function getAttributesFromDca($arrData, $strName, $varValue=null,
}

$isKnownOption = false;

$varValue = StringUtil::deserialize($varValue, true);

foreach ($arrData['options'] as $k=>$v)
{
if (!\is_array($v))
{
$value = $blnIsAssociative ? $k : $v;

if ($varValue && $varValue == $value)
if (\in_array($value, $varValue))
{
$isKnownOption = true;
}
Expand All @@ -1350,7 +1351,7 @@ public static function getAttributesFromDca($arrData, $strName, $varValue=null,
{
$value = $blnIsAssoc ? $kk : $vv;

if ($varValue && $varValue == $value)
if (\in_array($value, $varValue))
{
$isKnownOption = true;
}
Expand Down

0 comments on commit a392eea

Please sign in to comment.