Skip to content

Commit

Permalink
UI: some rendering of button.
Browse files Browse the repository at this point in the history
  • Loading branch information
klees committed Jul 13, 2016
1 parent a350188 commit 6287249
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/UI/Implementation/Component/Button/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@

use ILIAS\UI\Implementation\Render\AbstractComponentRenderer;
use ILIAS\UI\Renderer as RendererInterface;
use ILIAS\UI\Component\Component;
use ILIAS\UI\Component;

class Renderer extends AbstractComponentRenderer {
/**
* @inheritdocs
*/
public function render(Component $component, RendererInterface $default_renderer) {
public function render(Component\Component $component, RendererInterface $default_renderer) {
$this->checkComponent($component);

print_r($component);
$tpl = $this->getTemplate("tpl.primary.html", true, true);
$tpl->setCurrentBlock($component->getType());
$tpl->setVariable("NUMBER", $component->getNumber());
$tpl->parseCurrentBlock();
if ($component instanceof Component\Button\Primary) {
$tpl_name = "tpl.primary.html";
}
if ($component instanceof Component\Button\Standard) {
$tpl_name = "tpl.standard.html";
}

$tpl = $this->getTemplate($tpl_name, true, true);
$tpl->setVariable("ACTION", $component->getAction());
$tpl->setVariable("LABEL", $component->getLabel());

return $tpl->get();
}
Expand All @@ -28,6 +33,9 @@ public function render(Component $component, RendererInterface $default_renderer
* @inheritdocs
*/
protected function getComponentInterfaceName() {
return "\\ILIAS\\UI\\Component\\Button\\Button";
return array
( Component\Button\Primary::class
, Component\Button\Standard::class
);
}
}
1 change: 1 addition & 0 deletions src/UI/templates/default/Button/tpl.primary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="btn btn-default btn-primary" href="{ACTION}">{LABEL}</a>
1 change: 1 addition & 0 deletions src/UI/templates/default/Button/tpl.standard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="btn btn-default" href="{ACTION}"}>{LABEL}</a>

0 comments on commit 6287249

Please sign in to comment.