mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Base getLoadValue to look at form field first
Fixes https://github.com/octobercms/october/pull/2663 Adding to build 420+ because this might cause some issues, although it shouldn't. Hoping we don't ever have to roll this back because it fixes another inconsistency when using the model `filterFields` method... some will change values via $field->value (field accessor) and others will change via $this->value ($model accessor). This now puts the field accessor at a consistent priority (first) while retaining the fallback to model.
This commit is contained in:
parent
f7d0d394f5
commit
edcd899a79
@ -123,6 +123,10 @@ abstract class FormWidgetBase extends WidgetBase
|
|||||||
*/
|
*/
|
||||||
public function getLoadValue()
|
public function getLoadValue()
|
||||||
{
|
{
|
||||||
|
if ($this->formField->value !== null) {
|
||||||
|
return $this->formField->value;
|
||||||
|
}
|
||||||
|
|
||||||
$defaultValue = !$this->model->exists
|
$defaultValue = !$this->model->exists
|
||||||
? $this->formField->getDefaultFromData($this->data ?: $this->model)
|
? $this->formField->getDefaultFromData($this->data ?: $this->model)
|
||||||
: null;
|
: null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user