FormController is now responsible for purging data from the set (NO_SAVE_DATA)

This commit is contained in:
Samuel Georges 2014-12-05 18:38:04 +11:00
parent ab24c547a2
commit c485622f5b
2 changed files with 3 additions and 7 deletions

View File

@ -7,6 +7,7 @@ use Event;
use Input;
use Redirect;
use Backend;
use Backend\Classes\FormField;
use Backend\Classes\ControllerBehavior;
use October\Rain\Support\Util;
use October\Rain\Router\Helper as RouterHelper;
@ -687,7 +688,7 @@ class FormController extends ControllerBehavior
) {
$this->setModelAttributes($model->{$attribute}, $value);
}
else {
elseif ($value !== FormField::NO_SAVE_DATA) {
$model->{$attribute} = $value;
}
}

View File

@ -807,12 +807,7 @@ class Form extends WidgetBase
$dotted = implode('.', $parts);
$widgetValue = $widget->getSaveData(array_get($data, $dotted));
if ($widgetValue === FormField::NO_SAVE_DATA) {
array_forget($data, $dotted);
}
else {
array_set($data, $dotted, $widgetValue);
}
array_set($data, $dotted, $widgetValue);
}
/*