mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Use ::create instead of new in GridFieldDetailForm_ItemRequest (#10791)
Updates instances of `new X` to `X::create` so that Silverstripe classes will respect dependency injection
This commit is contained in:
parent
e8bde0f4f5
commit
e98f0d45af
@ -137,7 +137,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
$form = $this->ItemEditForm();
|
||||
$form->makeReadonly();
|
||||
|
||||
$data = new ArrayData([
|
||||
$data = ArrayData::create([
|
||||
'Backlink' => $controller->Link(),
|
||||
'ItemEditForm' => $form
|
||||
]);
|
||||
@ -235,7 +235,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
}
|
||||
}
|
||||
|
||||
$form = new Form(
|
||||
$form = Form::create(
|
||||
$this,
|
||||
'ItemEditForm',
|
||||
$fields,
|
||||
@ -434,7 +434,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
$oneLevelUp->Link, // url
|
||||
_t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.CancelBtn', 'Cancel') // label
|
||||
);
|
||||
$actions->insertAfter('MajorActions', new LiteralField('cancelbutton', $text));
|
||||
$actions->insertAfter('MajorActions', LiteralField::create('cancelbutton', $text));
|
||||
}
|
||||
}
|
||||
|
||||
@ -879,17 +879,17 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
||||
$items = $this->popupController->Breadcrumbs($unlinked);
|
||||
|
||||
if (!$items) {
|
||||
$items = new ArrayList();
|
||||
$items = ArrayList::create();
|
||||
}
|
||||
|
||||
if ($this->record && $this->record->ID) {
|
||||
$title = ($this->record->Title) ? $this->record->Title : "#{$this->record->ID}";
|
||||
$items->push(new ArrayData([
|
||||
$items->push(ArrayData::create([
|
||||
'Title' => $title,
|
||||
'Link' => $this->Link()
|
||||
]));
|
||||
} else {
|
||||
$items->push(new ArrayData([
|
||||
$items->push(ArrayData::create([
|
||||
'Title' => _t('SilverStripe\\Forms\\GridField\\GridField.NewRecord', 'New {type}', ['type' => $this->record->i18n_singular_name()]),
|
||||
'Link' => false
|
||||
]));
|
||||
|
Loading…
Reference in New Issue
Block a user