mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Add Sortable Behavior to ReorderController validateModel (#5268)
Checks for the newly added Sortable Behavior as well as the existing Sortable Trait. See b19deb853f
This commit is contained in:
parent
fffa6db8d8
commit
59d183b3b0
@ -214,7 +214,10 @@ class ReorderController extends ControllerBehavior
|
||||
$model = $this->controller->reorderGetModel();
|
||||
$modelTraits = class_uses($model);
|
||||
|
||||
if (isset($modelTraits[\October\Rain\Database\Traits\Sortable::class])) {
|
||||
if (
|
||||
isset($modelTraits[\October\Rain\Database\Traits\Sortable::class]) ||
|
||||
$model->isClassExtendedWith(\October\Rain\Database\Behaviors\Sortable::class)
|
||||
) {
|
||||
$this->sortMode = 'simple';
|
||||
}
|
||||
elseif (isset($modelTraits[\October\Rain\Database\Traits\NestedTree::class])) {
|
||||
@ -222,7 +225,7 @@ class ReorderController extends ControllerBehavior
|
||||
$this->showTree = true;
|
||||
}
|
||||
else {
|
||||
throw new ApplicationException('The model must implement the NestedTree or Sortable traits.');
|
||||
throw new ApplicationException('The model must implement the Sortable trait/behavior or the NestedTree trait.');
|
||||
}
|
||||
|
||||
return $model;
|
||||
|
Loading…
x
Reference in New Issue
Block a user