From c624b35612b530797b95ee6644d79493e783d495 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 20 Jul 2020 23:49:17 +0200 Subject: [PATCH] Added the option to override the id when replacing links with bbcodes --- .../files/lib/system/html/node/HtmlNodePlainLink.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/node/HtmlNodePlainLink.class.php b/wcfsetup/install/files/lib/system/html/node/HtmlNodePlainLink.class.php index a04419c5fb..caaa0cd40b 100644 --- a/wcfsetup/install/files/lib/system/html/node/HtmlNodePlainLink.class.php +++ b/wcfsetup/install/files/lib/system/html/node/HtmlNodePlainLink.class.php @@ -138,9 +138,10 @@ class HtmlNodePlainLink { * Replaces the entire link, including any formatting, with the provided bbcode. This is * available for standalone links only. * - * @param BBCode $bbcode + * @param BBCode $bbcode + * @param int|null $overrideObjectID */ - public function replaceWithBBCode(BBCode $bbcode) { + public function replaceWithBBCode(BBCode $bbcode, $overrideObjectID = null) { $this->markAsTainted(); if ($this->objectID === 0) { @@ -149,7 +150,7 @@ class HtmlNodePlainLink { $metacodeElement = $this->link->ownerDocument->createElement('woltlab-metacode'); $metacodeElement->setAttribute('data-name', $bbcode->bbcodeTag); - $metacodeElement->setAttribute('data-attributes', base64_encode(JSON::encode([$this->objectID]))); + $metacodeElement->setAttribute('data-attributes', base64_encode(JSON::encode([($overrideObjectID !== null ? $overrideObjectID : $this->objectID)]))); if ($bbcode->isBlockElement) { if (!$this->isStandalone()) { -- 2.20.1