From 48824543b22fda7ebdda8a032cfa04cfb3b085e5 Mon Sep 17 00:00:00 2001 From: Tim Schmitz <104776863+schmitz-ilias@users.noreply.github.com> Date: Fri, 29 Sep 2023 17:09:16 +0200 Subject: [PATCH] ContainerReference: fix empty title on creation (32383) (#6364) --- Services/ContainerReference/ROADMAP.md | 20 +++++++++++++++++++ .../classes/class.ilContainerReferenceGUI.php | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Services/ContainerReference/ROADMAP.md diff --git a/Services/ContainerReference/ROADMAP.md b/Services/ContainerReference/ROADMAP.md new file mode 100644 index 000000000000..76c62567650f --- /dev/null +++ b/Services/ContainerReference/ROADMAP.md @@ -0,0 +1,20 @@ +# Roadmap + +## Short Term + +... + +## Mid Term + +### Listen for changes of target object's title + +ContainerReference objects that reuse the title of their target should update their title +when the target does, e.g. via event handling. Currently, different components +handle the rendering of the title of references differently, some looking up +the title of the target and some just using the title of the reference directly from +object_data, leading to inconsistent results when the title of the target is +changed. + +## Long Term + +... \ No newline at end of file diff --git a/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php b/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php index 0b22b2f61f8b..ce5171dee793 100644 --- a/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php +++ b/Services/ContainerReference/classes/class.ilContainerReferenceGUI.php @@ -239,6 +239,8 @@ protected function afterSave(ilObject $a_new_object) $a_new_object->setTitleType($this->form->getInput('title_type')); if ($this->form->getInput('title_type') == ilContainerReference::TITLE_TYPE_CUSTOM) { $a_new_object->setTitle($this->form->getInput('title')); + } elseif ($this->form->getInput('title_type') == ilContainerReference::TITLE_TYPE_REUSE) { + $a_new_object->setTitle(ilObject::_lookupTitle($a_new_object->getTargetId())); } $a_new_object->update(); @@ -349,7 +351,7 @@ protected function initForm($a_mode = self::MODE_EDIT) array_merge( array($this->getTargetType()), array("root", "cat", "grp", "fold", "crs") - ) + ) ); $repo->setInfo($this->lng->txt($this->getReferenceType() . '_edit_info'));