Page MenuHomePhabricator

default mw.wikibase.label() to the connected item of a page
Closed, ResolvedPublic1 Story Points

Description

it would be nice if mw.wikibase.label() would default to the connected item of a page.

same for mw.wikibase.description() and mw.wikibase.sitelink()

right now, I get "Lua error: id must be of type string, nil given." error.

Event Timeline

aude created this task.May 14 2015, 1:30 PM
aude updated the task description. (Show Details)
aude raised the priority of this task from to Needs Triage.
aude added a subscriber: aude.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 14 2015, 1:30 PM

Change 210907 had a related patch set uploaded (by Aude):
Default mw.wikibase.* lua functions to the connected item of a page

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

aude added a comment.EditedMay 14 2015, 3:17 PM

right now, a lot of modules have code like:

function getId( id )
    if not mw.wikibase then
           return "wikibase module not found"
    end
 
    if id then return id end
 
    entity = mw.wikibase.getEntityObject()
    if not entity then return nil end
    return entity.id
end

-- Returns the local page of the data item provided.
function p.page(frame)
    id = getId(frame.args[1])
    if id == nil then
           return "(no element found)"
    end
    return mw.wikibase.sitelink( id )
end

http://en.wikivoyage.org/wiki/Module:Wikibase

this would become unnecessary, and is intuiatively how I expected and thought these things worked.

Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.
Lydia_Pintscher triaged this task as Normal priority.
Lydia_Pintscher set Security to None.
Lydia_Pintscher added a subscriber: Lydia_Pintscher.
aude claimed this task.May 18 2015, 7:33 PM
aude moved this task from Backlog to Review on the Wikidata-Sprint-2015-05-05 board.
Tobi_WMDE_SW edited a custom field.May 25 2015, 11:08 AM

Change 210907 merged by jenkins-bot:
Default mw.wikibase.* lua functions to the connected item of a page

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

hoo closed this task as Resolved.May 29 2015, 2:27 AM
hoo removed a project: Patch-For-Review.
hoo moved this task from Review to Done on the Wikidata-Sprint-2015-05-05 board.