Page MenuHomePhabricator

default mw.wikibase.label() to the connected item of a page
Closed, ResolvedPublic1 Estimated 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 raised the priority of this task from to Needs Triage.
aude updated the task description. (Show Details)
aude added a subscriber: aude.

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

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 set Security to None.
Lydia_Pintscher added a subscriber: Lydia_Pintscher.

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 removed a project: Patch-For-Review.
hoo moved this task from Review to Done on the Wikidata-Sprint-2015-05-05 board.