$v = 0;
}
} else if ($field instanceof Color) {
- $v = FluidbookTheme::_colorToWS3($v);
+ if ($v === '' && $field->getAttribute('allows_empty')) {
+
+ } else {
+ $v = FluidbookTheme::_colorToWS3($v);
+ }
} else if ($field instanceof Files) {
continue;
}
public static function _colorToWS3($data)
{
+ $data = trim($data);
if (!isset(self::$_colorToWS3Cache[$data])) {
- if (strlen($data) < 6) {
+ if ($data !== '' && strlen($data) < 6) {
$data = str_repeat('0', 6 - strlen($data)) . $data;
}
if (strlen($data) === 6) {