mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
getSaveData -> getSaveValue
This commit is contained in:
parent
59c9146b4f
commit
0be582c42d
@ -87,11 +87,11 @@ abstract class FormWidgetBase extends WidgetBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the postback data for this widget.
|
||||
* Process the postback value for this widget.
|
||||
* @param $value The existing value for this widget.
|
||||
* @return string The new value for this widget.
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
@ -131,4 +131,5 @@ abstract class FormWidgetBase extends WidgetBase
|
||||
|
||||
return [$model, $last];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class ColorPicker extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
return strlen($value) ? $value : null;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class DataGrid extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class DataTable extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
$dataSource = $this->table->getDataSource();
|
||||
|
||||
|
@ -120,7 +120,7 @@ class DatePicker extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
if (!strlen($value)) {
|
||||
return null;
|
||||
|
@ -195,7 +195,7 @@ class FileUpload extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
return FormField::NO_SAVE_DATA;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class RecordFinder extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
return strlen($value) ? $value : null;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class Relation extends FormWidgetBase
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSaveData($value)
|
||||
public function getSaveValue($value)
|
||||
{
|
||||
if (is_string($value) && !strlen($value)) {
|
||||
return null;
|
||||
|
@ -710,7 +710,9 @@ class Form extends WidgetBase
|
||||
}
|
||||
|
||||
$fieldName = $field->fieldName;
|
||||
$defaultValue = (!$this->model->exists && $field->defaults !== '') ? $field->defaults : null;
|
||||
$defaultValue = (!$this->model->exists && $field->defaults !== '')
|
||||
? $field->defaults
|
||||
: null;
|
||||
|
||||
/*
|
||||
* Array field name, eg: field[key][key2][key3]
|
||||
@ -806,7 +808,16 @@ class Form extends WidgetBase
|
||||
$parts = Str::evalHtmlArray($field);
|
||||
$dotted = implode('.', $parts);
|
||||
|
||||
$widgetValue = $widget->getSaveValue(array_get($data, $dotted));
|
||||
|
||||
/*
|
||||
* @deprecated Remove if year >= 2016
|
||||
*/
|
||||
if (method_exists($widget, 'getSaveData')) {
|
||||
traceLog('Method getSaveData() is deprecated, use getSaveValue() instead. Found in: ' . get_class($widget), 'warning');
|
||||
$widgetValue = $widget->getSaveData(array_get($data, $dotted));
|
||||
}
|
||||
|
||||
array_set($data, $dotted, $widgetValue);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user