19 declare(strict_types=1);
38 $tpl = $this->
getTemplate(
"tpl.scale_bar.html",
true,
true);
40 $items = $component->getItems();
41 if (count($items) == 0) {
45 $width = str_replace(
",",
".", (
string) round(100 / count($items), 5));
47 foreach ($component->getItems() as
$txt => $active) {
49 $tpl->setCurrentBlock(
"active");
50 $tpl->setVariable(
"TXT_ACTIVE", $this->
txt(
"active"));
51 $tpl->parseCurrentBlock();
52 $tpl->touchBlock(
"active_class");
55 $tpl->setCurrentBlock(
"item");
56 $tpl->setVariable(
"ITEM_TEXT", $txt);
57 $tpl->setVariable(
"ITEM_WIDTH", $width);
58 $tpl->parseCurrentBlock();
render(Component\Component $component, RendererInterface $default_renderer)
txt(string $id)
Get a text from the language file.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
Base class for all component renderers.