Added support for custom `[wsp]` title
authorAlexander Ebert <ebert@woltlab.com>
Wed, 1 Mar 2017 11:12:08 +0000 (12:12 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 1 Mar 2017 11:12:08 +0000 (12:12 +0100)
See #2187

com.woltlab.wcf/bbcode.xml
wcfsetup/install/files/lib/system/bbcode/WoltLabSuitePageBBCode.class.php

index 4e3a673b0faad9c5d8b916d77c38c254e10cc07c..70977a2b882fcd97389768e35b8a6e7068908296 100644 (file)
                                        <validationpattern>^\d+$</validationpattern>
                                        <required>1</required>
                                </attribute>
+                               <attribute name="1">
+                                       <usetext>1</usetext>
+                               </attribute>
                        </attributes>
                </bbcode>
                
index f9a982179436a11533ce42cda2217c5717f69814..69b77f7425f68e5cf52a7bd792bcf669e64048f0 100644 (file)
@@ -23,10 +23,12 @@ class WoltLabSuitePageBBCode extends AbstractBBCode {
                        return '';
                }
                
+               $title = (!empty($openingTag['attributes'][1])) ? StringUtil::trim($openingTag['attributes'][1]) : '';
+               
                /** @var Page $page */
                $page = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.page', $pageID);
                if ($page !== null) {
-                       return StringUtil::getAnchorTag($page->getLink(), $page->getTitle());
+                       return StringUtil::getAnchorTag($page->getLink(), $title ?: $page->getTitle());
                }
                
                return '';