Page MenuHomePhabricator

[Story] Add convenience method in lua that gives the ItemId of the connected page
Closed, ResolvedPublic

Description

there should be a convenience method in Wikibase lua that gives the ItemId of the connected page. This can be simple as exposing the getEntityIdForCurrentPage method in mw.wikibase.lua. This method gets the id via SiteLinkLookup which is efficient.

Right now, for example on enwiki, they have such a method but it requires loading the entity object just to get the id, which is not so efficient.

https://en.wikipedia.org/wiki/Module:Wikibase

PS. for the methods in the module that get the label and site link, I think fetching the entity id is not necessary since mw.wikibase.label and mw.wikibase.sitelink internally do that automatically (via SiteLinkLookup) if id is not provided as an argument.

Event Timeline

aude created this task.Aug 28 2015, 2:50 PM
aude raised the priority of this task from to Needs Triage.
aude updated the task description. (Show Details)
aude added a subscriber: aude.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 28 2015, 2:50 PM
aude renamed this task from Add convenience method in lua that gives the ItemId of the connected page to [Story] Add convenience method in lua that gives the ItemId of the connected page.Sep 10 2015, 10:18 AM
aude set Security to None.
aude triaged this task as Normal priority.Sep 10 2015, 10:28 AM
JanZerebecki moved this task from incoming to ready to go on the Wikidata board.Sep 10 2015, 6:56 PM

Change 241050 had a related patch set uploaded (by Ricordisamoa):
Add mw.wikibase.getEntityIdForCurrentPage()

https://gerrit.wikimedia.org/r/241050

Yurik added a subscriber: Yurik.Jul 13 2016, 7:17 PM

I think this should be extended to wiki markup parser function - there are cases when i need the wikidata id of the current page

Change 241050 merged by jenkins-bot:
Add mw.wikibase.getEntityIdForCurrentPage()

https://gerrit.wikimedia.org/r/241050

hoo closed this task as Resolved.Aug 2 2016, 10:22 AM
hoo claimed this task.
hoo removed a project: Patch-For-Review.
Yurik added a comment.Aug 2 2016, 10:47 AM

@hoo did you add a parser function as well, or should I create a new task?

hoo added a comment.Aug 2 2016, 10:48 AM

@hoo did you add a parser function as well, or should I create a new task?

I didn't, please create a new task for that.