Module:WikidataIB/doc: Difference between revisions

Content deleted Content added
Usage: locally supplied value if it is supplied is the second unnamed parameter
Coding into an infobox: a little separation of lines
Line 18:
 
Typically, the getValue call will be invoked in an infobox definition, using appropriate template parameters. One simple implementation is given as an example in [[:Template:Infobox book/Wikidata/Sandbox]]. As an illustration, the 'author' field in the infobox is coded like this:
<pre style="line-height:1.2em;">
<syntaxhighlight lang="wikitext">
| label2 = Author{{#if:{{{authors|}}}|s}}
| data2 = {{#invoke:WikidataIB |getValue |P50 |name=author |fetchwikidata={{{fetchwikidata|}}} |suppressfields={{{suppressfields|}}} |{{{authors|{{{author|}}}}}} }}
</pre>
</syntaxhighlight>
The property to be fetched is the first unnamed parameter. In this case it is {{Q|P50}}.