Page MenuHomePhabricator

Add SelfLinkBegin hook in Linker.php
Closed, ResolvedPublic


If a link to a page exists on the page itself, it currently is displayed as the page title in bold text. The SelfLinkBegin hook (gerrit I343e1b1b08ec841d22a1b22bcb8af43bb65a5a50) allows extensions to modify the text that is displayed. This new functionality is desirable in the SemanticTitle extension. The SemanticTitle extension enables the display semantic property on a page as a user-friendly page title instead of the actual page title. The use of the SelfLinkBegin hook can be seen in SemanticTitle in gerrit I593f263723498aa28ff945c4094f27d817c1ad27.

As an example of how you can test this feature, install Semantic MediaWiki and SemanticTitle and set

$wgSemanticTitleProperties = array(
       NS_MAIN => "Title"

Create a property page named Property:Title containing "[[Has type::Text]]". Create a test page in the main namespace containing the text:

{{#set:Title=Semantic Title}}

Currently, the page will display the title of the test page in bold. With the two patches above applied, the page will display the text "Semantic Title" in bold.

While this example is very simplistic, a more complex example where this is necessary is a page that includes a Semantic MediaWiki #ask query that has a link to the current page in the query results. Consider a page for an author that lists citations to all of the author's works as a result of a query. Each citation would include the list of authors, including co-authors, as links to their author pages. Using SemanticTitle, each author page can exist with a title of the form "Author:xxxxxx" in the Author namespace, where xxxxxx is a unique number, with the page title displayed as the author's name using a property on the page. However, in the citation list, the link to the author in question would be displayed as the bold text Author:xxxxxx, where xxxxxx is the unique number for the current author page, rather than the author's name.

Version: 1.23.0
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.
bzimport set Reference to bz63592.
bzimport added a subscriber: Unknown Object (MLST).
cicalese created this task.Apr 6 2014, 12:58 PM

Hi Cindy, thanks for taking the time to report this and providing a patch.

Setting PATCH_TO_REVIEW status for (for the records, this is done automatically when following [[mw:Gerrit/Commit message guidelines]])

Hi Cindy, thanks for your email asking for the status here.

As this is now blocked on reviewing the patch, I'd recommend to add a comment in asking for another review and/or merge.

Done - thanks for the advice!

Change 124149 had a related patch set uploaded by Cicalese:
Add SelfLinkBeginHook

Change 124149 merged by jenkins-bot:
Add SelfLinkBeginHook

Patch mentioned in this report was merged - assuming this bug is FIXED.
If that is not the case: Please reopen and elaborate what is left to do here to get this report fixed.