Modul:PropertyLink: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 40: | Zeile 40: | ||
return getLabel( string.lower(frame.args[1] )) | return getLabel( string.lower(frame.args[1] )) | ||
end | end | ||
function getImageLink( propName, width) | function getImageLink( propName, width) | ||
local entity = mw.wikibase.getEntity() | local entity = mw.wikibase.getEntity() | ||
if not entity or not entity.claims then return end --the entity doesnt exist or have no claims | if not entity or not entity.claims then return end --the entity doesnt exist or have no claims | ||
local property = entity.claims[propName or " | local property = entity.claims[propName or "P4"] | ||
if property then | if property then | ||
local width = width or "220" | local width = width or "220" | ||
return mw.ustring.format( '[[File:%s|%spx]]', property[ | return mw.ustring.format( '[[File:%s|%spx]]', property[1].mainsnak.datavalue.value, width ) | ||
end | end | ||
end | end |