Skip to content

Commit

Permalink
Fixed: Wrong implementation of flatArray eval option
Browse files Browse the repository at this point in the history
  • Loading branch information
psi-4ward committed May 4, 2012
1 parent 06455a0 commit 1cc4e44
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions system/modules/multicolumnwizard/MultiColumnWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,41 @@ public function __set($strKey, $varValue)
}


public function __get($strKey)
{
switch ($strKey)
{
case 'value':
/**
* reformat array if we have only one field
* from array[]['fieldname'] = value
* to array[] = value
* so we have the same behavoir like multiple-checkbox fields
*/
if ($this->flatArray)
{
$arrNew = array();

foreach ($this->varValue as $val)
{
$arrNew[] = $val[key($this->columnFields)];
}

return $arrNew;
}
else
{
return parent::__get($strKey);
}
break;

default:
return parent::__get($strKey);
break;
}
}


protected function validator($varInput)
{
for ($i = 0; $i < count($varInput); $i++)
Expand Down Expand Up @@ -274,24 +309,6 @@ protected function validator($varInput)
$this->addError($GLOBALS['TL_LANG']['ERR']['general']);
}

/**
* reformat array if we have only one field
* from array[]['fieldname'] = value
* to array[] = value
* so we have the same behavoir like multiple-checkbox fields
*/
if ($this->flatArray)
{
$arrNew = array();

foreach ($varInput as $val)
{
$arrNew[] = $val[key($this->columnFields)];
}

$varInput = $arrNew;
}

return $varInput;
}

Expand Down

0 comments on commit 1cc4e44

Please sign in to comment.