Skip to content

Commit

Permalink
Fixed bug with missing unit in inputUnid fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Jul 21, 2015
1 parent b41585c commit e5f0fb1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/MadeYourDay/Contao/ThemeAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,15 @@ public function onsubmitCallback(\DataContainer $dc)
}
}
elseif ($data['templateVars'][$key]['type'] === 'length') {
if ($value && isset($value['value']) && isset($value['unit'])) {
$value = (trim($value['value']) ? trim($value['value']) : '0') . trim($value['unit']);
if (is_array($value)) {
$value['value'] = empty($value['value']) ? '0' : $value['value'];
$value['unit'] = empty($value['unit']) ? '' : $value['unit'];
$value = trim($value['value']) . trim($value['unit']);
}
if (! $value) {
else if (is_string($value) && trim($value)) {
$value = trim($value);
}
else {
$value = '0';
}
}
Expand Down

0 comments on commit e5f0fb1

Please sign in to comment.