Robert Vogel has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358921 )

Change subject: Add support for links with colons in Widgets
......................................................................


Add support for links with colons in Widgets

User might want to add links to Categories of images in Focus sidebar.
Those links must be added using [[:Category:Name]] because otherwise the
user sidebar page will added to that category instead of displaying it

But adding links prefixed with colon didnt work, causing links not to
appear on Focus sidebar

ERM: #6599

Needs cherry-picking to REL1_27 and REL1_23

Change-Id: I5cc91d38059c54ba5479abb636fc94f3908155cd
---
M includes/utility/WidgetListHelper.class.php
1 file changed, 16 insertions(+), 5 deletions(-)

Approvals:
  Pwirth: Verified; Looks good to me, approved



diff --git a/includes/utility/WidgetListHelper.class.php 
b/includes/utility/WidgetListHelper.class.php
index ebe3dfc..003979e 100644
--- a/includes/utility/WidgetListHelper.class.php
+++ b/includes/utility/WidgetListHelper.class.php
@@ -154,18 +154,29 @@
                                $sLine = $this->cleanWikiLink( $sLine );
 
                                $sTitle = $sLine;
-                               $sDescription = $sLine;
 
-                               $aParts = explode('|', $sLine, 2);
-                               if (count($aParts) > 1) {
+                               $bIsColonLink = false;
+                               if( strpos( $sTitle, ':' ) === 0 ) {
+                                       $bIsColonLink = true;
+                                       $sTitle = ltrim( $sTitle, ':' );
+                               }
+                               $sDescription = $sTitle;
+
+                               $aParts = explode( '|', $sTitle, 2 );
+                               if ( count( $aParts ) > 1) {
                                        $sTitle = $aParts[0];
                                        $sDescription = $aParts[1];
                                }
 
                                $oTitle = Title::newFromText( $sTitle );
-                               if (is_object($oTitle)) { // CR RBV (06.06.11 
15:25): Why not $oTitle === null?
+
+                               if ( $oTitle ) {
+                                       $sTitle = $oTitle->getPrefixedText();
+                                       if( $bIsColonLink ) {
+                                               $sTitle = ':' . $sTitle;
+                                       }
                                        $oCustomListView->addData(array(
-                                               'TITLE' => 
$oTitle->getPrefixedText(),
+                                               'TITLE' => $sTitle,
                                                'DESCRIPTION' => 
BsStringHelper::shorten( $sDescription, array( 'max-length' => 25, 'position' 
=> 'middle' ) )
                                                )
                                        );

-- 
To view, visit https://gerrit.wikimedia.org/r/358921
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5cc91d38059c54ba5479abb636fc94f3908155cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: REL1_23
Gerrit-Owner: Pwirth <[email protected]>
Gerrit-Reviewer: ItSpiderman <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to