Return variant exit to parent set

This commit is contained in:
Wojtek
2026-10-16 10:26:37 +02:00
parent 8abee59a49
commit 0f1bd3e9fe
4 changed files with 21 additions and 2 deletions
@@ -0,0 +1 @@
-- No database changes required for version 1.37.0.
@@ -19,6 +19,24 @@ class SetController extends FormController
public function cancel($key = null)
{
$parentId = $this->input->getInt('parent_id');
$formData = (array) $this->input->post->get('jform', [], 'array');
$parentId = (int) ($formData['parent_id'] ?? $parentId);
if ($parentId < 1) {
$itemId = $this->input->getInt('id');
if ($itemId > 0) {
$item = $this->getModel()->getItem($itemId);
$parentId = (int) ($item->parent_id ?? 0);
}
}
if ($parentId > 0) {
$this->setRedirect('index.php?option=com_testquestions&task=set.edit&id=' . $parentId);
return true;
}
$this->setRedirect('index.php?option=com_testquestions&view=sets');
return true;