From 77aa8b62d8f045d045a79d9fdbf179e1212df9c8 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Mon, 23 Oct 2023 21:32:14 +0200 Subject: [PATCH] fixed 38221: When switching from custom to reused title in the settings of ContainerReferences, the title is not immediately updated --- .../classes/class.ilContainerReferenceGUI.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php b/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php index 3b70b0131eaf..89dbaf40747e 100644 --- a/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php +++ b/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php @@ -292,11 +292,6 @@ protected function loadPropertiesFromSettingsForm(ilPropertyFormGUI $form): bool $ok = true; $access = $DIC->access(); - $this->object->setTitleType((int) $form->getInput('title_type')); - if ((int) $form->getInput('title_type') === ilContainerReference::TITLE_TYPE_CUSTOM) { - $this->object->setTitle($form->getInput('title')); - } - // check access if ( !$access->checkAccess('visible', '', (int) $form->getInput('target_id')) @@ -318,6 +313,14 @@ protected function loadPropertiesFromSettingsForm(ilPropertyFormGUI $form): bool ilObject::_lookupObjId((int) $form->getInput('target_id')) ); + // set title after target id, so that the title can be reused immediately + $this->object->setTitleType((int) $form->getInput('title_type')); + if ((int) $form->getInput('title_type') === ilContainerReference::TITLE_TYPE_CUSTOM) { + $this->object->setTitle($form->getInput('title')); + } elseif ((int) $form->getInput('title_type') === ilContainerReference::TITLE_TYPE_REUSE) { + $this->object->setTitle(ilObject::_lookupTitle($this->object->getTargetId())); + } + return $ok; }