2014-11-30, 01:09:05
(2014-11-30, 00:40:36)Amaury Wrote: Thank you for your your useful plugin.
I just encountered a problem, maybe a small bug:
If I add images in a Multi Image Field for a special page and save the page. It works fine. I can add or suppress one or several images, it works always fine. But when I suppress all images in the Multi Image Field, there is no way to save the page! I tried with debug mode and no specific php warning or error.
I used both version 1.16 and new version 1.17. and encountered the same issue.
Thank you for your help.
I made a small patch, I changed lines in SPEValidator.php (after line 79).
I made the test if ( empty($valResult['fields'][$name]) ) before to find records and iterate over it and not after as it was.
PHP Code:
if ( $fData['new-type'] == 'multiimage' ){
//if we are here, field is not empty
$valResult['fields'][$name] = array();
if ( empty($valResult['fields'][$name]) ) {
$valResult['fields'][$name] = true;
} else {
$arr = explode('||', $value); //find records and iterate over it
for ($b = 0; $b < count($arr); $b++) {
if ( !self::_validateImage($arr[$b], $fData)){ //apply check that all are images
$valResult['fields'][$name][] = $b;
$valResult['validation-failed'] = true;
}
}
}
continue;
It seems now everything works fine, I can save page with empty Multi Image Field.