Skip to content

Commit 9930ea4

Browse files
authored
Merge pull request #3104 from Laravel-Backpack/fix-save-action-order-picking
[4.1] Fixing save action order picking
2 parents d9e6201 + 006d7c2 commit 9930ea4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/app/Library/CrudPanel/Traits/SaveActions.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ public function getSaveActionDefaultForCurrentOperation()
2424
*/
2525
public function getFallBackSaveAction()
2626
{
27-
//we get the higher order in save actions array. It will return something only when explicit by developer
27+
//we get the higher order in save actions array. By default it would be `save_and_back`
2828
$higherAction = $this->getSaveActionByOrder(1);
2929

30-
if (empty($higherAction)) {
31-
if ($this->hasOperationSetting('defaultSaveAction')) {
32-
return $this->getOperationSetting('defaultSaveAction');
33-
}
30+
//if there is an higher action and that action is not the backpack default higher one `save_and_back` we return it.
31+
if (! empty($higherAction) && key($higherAction) !== 'save_and_back') {
32+
return key($higherAction);
33+
}
3434

35-
return $this->getSaveActionDefaultForCurrentOperation();
35+
if ($this->hasOperationSetting('defaultSaveAction')) {
36+
return $this->getOperationSetting('defaultSaveAction');
3637
}
3738

38-
return key($higherAction);
39+
return $this->getSaveActionDefaultForCurrentOperation();
3940
}
4041

4142
/**

0 commit comments

Comments
 (0)