Please add event validateStructure in Backend\Widgets\ListStructure

Please add event validateStructure in Backend\Widgets\ListStructure

public function onReorder()
{
    $item = $this->model->newQueryWithoutScopes()->find(post('record_id'));

    $this->fireSystemEvent('backend.list.validateStructure', [$item]); // <- this method

    if ($this->model->isClassInstanceOf(\October\Contracts\Database\NestedSetInterface::class)) {
        $this->reorderForNestedTree($item);
    } else {
        if ($this->model->hasRelation('parent')) {
            $this->reorderForSimpleTree($item);
        }

        if ($this->model->isClassInstanceOf(\October\Contracts\Database\SortableInterface::class)) {
            $this->reorderForSortable($item);
        }
    }

    $this->fireSystemEvent('backend.list.reorderStructure', [$item]);

    return $this->onRefresh();
}

The method is needed to check whether the record can be moved to the right place or not. Or for example, there is such a possibility or not. Now the record is simply transferred without the possibility of verification, and in some cases this can be critical

In version 3.3, the List Structure Permissions feature was added, this is not enough. Please add an event, for example to check if a post can only be moved to certain categories or if a post cannot be moved.

I have checked this today. It appears we added events for this already. Similar to what is proposed here.

  • backend.list.beforeReorderStructure
  • backend.list.reorderStructure

Hopefully it helps.

Thanks, i know, i’ve been using it for a long time

1 Like