From 17401d27890ce858c392a07789ad8443d4d3304a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Auswo=CC=88ger?= Date: Thu, 23 Mar 2023 11:33:08 +0100 Subject: [PATCH] Fix data truncated error for visibleArea settings, #82 --- src/Resources/contao/dca/tl_content.php | 4 ++++ src/Resources/contao/dca/tl_module.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Resources/contao/dca/tl_content.php b/src/Resources/contao/dca/tl_content.php index 79df8c0..d497859 100644 --- a/src/Resources/contao/dca/tl_content.php +++ b/src/Resources/contao/dca/tl_content.php @@ -478,6 +478,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50 clr'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_thumbs_visibleAreaMax'] = array( @@ -485,6 +486,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_thumbs_slideMinSize'] = array( @@ -547,6 +549,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50 clr'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); // maximum size of the area for the visible slide in px @@ -555,6 +558,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); // Alignment of the visible area (0 = start, 0.5 = center, 1 = end) diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index 91ff233..17d07f4 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -478,6 +478,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50 clr'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_thumbs_visibleAreaMax'] = array( @@ -485,6 +486,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_thumbs_slideMinSize'] = array( @@ -547,6 +549,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50 clr'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); // maximum size of the area for the visible slide in px @@ -555,6 +558,7 @@ 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), + 'save_callback' => [function($value) { return (float) $value; }], 'sql' => "double unsigned NOT NULL default '0'", ); // Alignment of the visible area (0 = start, 0.5 = center, 1 = end)