Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb1b78d

Browse files
author
Pedro
committed
fixed widget value
1 parent 834c1d6 commit cb1b78d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/widget/mmWidgetFormDateReadOnly.class.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ protected function configure($options = array(), $attributes = array())
5252
*/
5353
public function render($name, $value = null, $attributes = array(), $errors = array())
5454
{
55+
if(is_array($value))
56+
{
57+
if(isset($value['year']) && isset($value['month']) && isset($value['day']))
58+
{
59+
60+
$value = $value['year'] . '/' . $value['month'] . '/' . $value['day'];
61+
}
62+
else
63+
{
64+
throw new InvalidArgumentException('For array values please specify year, month and day keys');
65+
}
66+
}
5567
return parent::render($name . '_readonly', format_date($value), array_merge(array('disabled' => 'disabled'), $attributes), $errors) . $this->renderTag('input', array('type' => 'hidden', 'name' => $name, 'value' => $value, 'readonly' => 'readonly'));
5668
}
5769
}

0 commit comments

Comments
 (0)