Allow redirect: false on importExportController
Implement getFieldName() method
This commit is contained in:
parent
35296c5b26
commit
29040b416c
|
|
@ -721,8 +721,10 @@ class ImportExportController extends ControllerBehavior
|
|||
|
||||
protected function getRedirectUrlForType($type)
|
||||
{
|
||||
if ($redirect = $this->getConfig($type.'[redirect]')) {
|
||||
return Backend::url($redirect);
|
||||
$redirect = $this->getConfig($type.'[redirect]');
|
||||
|
||||
if ($redirect !== null) {
|
||||
return $redirect ? Backend::url($redirect) : 'javascript:;';
|
||||
}
|
||||
|
||||
return $this->controller->actionUrl($type);
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ abstract class FormWidgetBase extends WidgetBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the HTML element field name this form widget when
|
||||
* passing the value back when saving.
|
||||
* Returns the HTML element field name for this widget, used for capturing
|
||||
* user input, passed back to the getSaveValue method when saving.
|
||||
* @return string HTML element name
|
||||
*/
|
||||
public function getFieldName()
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ class CodeEditor extends FormWidgetBase
|
|||
$this->vars['margin'] = $this->margin;
|
||||
$this->vars['stretch'] = $this->formField->stretch;
|
||||
$this->vars['size'] = $this->formField->size;
|
||||
$this->vars['name'] = $this->formField->getName();
|
||||
$this->vars['readOnly'] = $this->readOnly;
|
||||
$this->vars['autocompletion'] = $this->autocompletion;
|
||||
$this->vars['enableSnippets'] = $this->enableSnippets;
|
||||
|
|
@ -176,6 +175,7 @@ class CodeEditor extends FormWidgetBase
|
|||
|
||||
// Double encode when escaping
|
||||
$this->vars['value'] = htmlentities($this->getLoadValue(), ENT_QUOTES, 'UTF-8', true);
|
||||
$this->vars['name'] = $this->getFieldName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class ColorPicker extends FormWidgetBase
|
|||
*/
|
||||
public function prepareVars()
|
||||
{
|
||||
$this->vars['name'] = $this->formField->getName();
|
||||
$this->vars['name'] = $this->getFieldName();
|
||||
$this->vars['value'] = $value = $this->getLoadValue();
|
||||
$this->vars['availableColors'] = $this->availableColors;
|
||||
$this->vars['isCustomColor'] = !in_array($value, $this->availableColors);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class DatePicker extends FormWidgetBase
|
|||
$value = $value instanceof Carbon ? $value->toDateTimeString() : $value;
|
||||
}
|
||||
|
||||
$this->vars['name'] = $this->formField->getName();
|
||||
$this->vars['name'] = $this->getFieldName();
|
||||
$this->vars['value'] = $value ?: '';
|
||||
$this->vars['field'] = $this->formField;
|
||||
$this->vars['mode'] = $this->mode;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class MarkdownEditor extends FormWidgetBase
|
|||
$this->vars['mode'] = $this->mode;
|
||||
$this->vars['stretch'] = $this->formField->stretch;
|
||||
$this->vars['size'] = $this->formField->size;
|
||||
$this->vars['name'] = $this->formField->getName();
|
||||
$this->vars['name'] = $this->getFieldName();
|
||||
$this->vars['value'] = $this->getLoadValue();
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ class MarkdownEditor extends FormWidgetBase
|
|||
|
||||
public function onRefresh()
|
||||
{
|
||||
$value = post($this->formField->getName());
|
||||
$value = post($this->getFieldName());
|
||||
$previewHtml = Markdown::parse($value);
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -38,16 +38,14 @@ class PermissionEditor extends FormWidgetBase
|
|||
*/
|
||||
public function prepareVars()
|
||||
{
|
||||
$this->vars['checkboxMode'] = $this->getControlMode() === 'checkbox';
|
||||
|
||||
$this->vars['permissions'] = BackendAuth::listTabbedPermissions();
|
||||
$this->vars['baseFieldName'] = $this->formField->getName();
|
||||
$permissionsData = $this->formField->getValueFromData($this->model);
|
||||
|
||||
if (!is_array($permissionsData)) {
|
||||
$permissionsData = [];
|
||||
}
|
||||
|
||||
$this->vars['checkboxMode'] = $this->getControlMode() === 'checkbox';
|
||||
$this->vars['permissions'] = BackendAuth::listTabbedPermissions();
|
||||
$this->vars['baseFieldName'] = $this->getFieldName();
|
||||
$this->vars['permissionsData'] = $permissionsData;
|
||||
$this->vars['field'] = $this->formField;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class RecordFinder extends FormWidgetBase
|
|||
public function onRefresh()
|
||||
{
|
||||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
$model->{$attribute} = post($this->formField->getName());
|
||||
$model->{$attribute} = post($this->getFieldName());
|
||||
|
||||
$this->prepareVars();
|
||||
return ['#'.$this->getId('container') => $this->makePartial('recordfinder')];
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class Repeater extends FormWidgetBase
|
|||
$config->model = $this->model;
|
||||
$config->data = array_get($loadValue, $index, []);
|
||||
$config->alias = $this->alias . 'Form'.$index;
|
||||
$config->arrayName = $this->formField->getName().'['.$index.']';
|
||||
$config->arrayName = $this->getFieldName().'['.$index.']';
|
||||
$config->isNested = true;
|
||||
|
||||
$widget = $this->makeWidget('Backend\Widgets\Form', $config);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class RichEditor extends FormWidgetBase
|
|||
$this->vars['fullPage'] = $this->fullPage;
|
||||
$this->vars['stretch'] = $this->formField->stretch;
|
||||
$this->vars['size'] = $this->formField->size;
|
||||
$this->vars['name'] = $this->formField->getName();
|
||||
$this->vars['name'] = $this->getFieldName();
|
||||
$this->vars['value'] = $this->getLoadValue();
|
||||
$this->vars['toolbarButtons'] = $this->evalToolbarButtons();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue