I have created a data object with linkdata and linktext arrays (text is just a string array with 4 items):
$links = array();
$texts = array();
foreach ($text as $t) {
$link = new moodle_url('/blocks/superiframe/view.php',
array('blockid' => $blockid, 'size' => $t));
$links[] = $link->out(false);
$texts[] = $t;
}
So I get arrays which I add to the data object I'm sending to the template:
$data->linkdata = $links;
$data->linktext = $texts;
array (size=4) 0 => 'http://localhost/moodle/blocks/superiframe/view.php?blockid=27&size=custom' (length=74) 1 => 'http://localhost/moodle/blocks/superiframe/view.php?blockid=27&size=small' (length=73) 2 => 'http://localhost/moodle/blocks/superiframe/view.php?blockid=27&size=medium' (length=74) 3 => 'http://localhost/moodle/blocks/superiframe/view.php?blockid=27&size=large' (length=73)Lovely. linktext is outputting the link text here using the implicit iterator. sfsg.
<div class = "{{class}}">
<div class="container">
<h3>{{name}}</h3>
<ul class="list-inline">
{{#linktext}}
<li class="list-inline-item">
{{#.}}
<a href="{{{link}}}">{{.}}</a>
{{/.}}
</li>
{{/linktext}}
</ul>
</div>
</div>
However the links on the page have the block id but not the additional size parameter.
What have I missed?
Full code: https://github.com/richardjonesnz/moodle-block_superiframe/tree/week8_challenge
Thanks if you can help.