ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.SymbolAdapterGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 protected const TYPE_GLYPH = 0;
29 protected \ILIAS\DI\UIServices $ui;
30 protected int $type = self::TYPE_GLYPH;
31 protected string $gl_type = "";
32 protected string $href = "";
33
34 public function __construct(
35 ) {
36 global $DIC;
37
38 $this->ui = $DIC->ui();
39 }
40
41 public function glyph(
42 string $gl_type,
43 string $href = ""
44 ): self {
45 $this->gl_type = $gl_type;
46 $this->href = $href;
47 $this->type = self::TYPE_GLYPH;
48 return $this;
49 }
50
51 protected function getSymbol(): \ILIAS\UI\Component\Symbol\Symbol
52 {
53 $gl = $this->gl_type;
54 $s = $this->ui->factory()->symbol()->glyph()->$gl(
55 $this->href
56 );
57 return $s;
58 }
59
60 public function render(): string
61 {
62 $s = $this->ui->renderer()->render($this->getSymbol());
63 // workaround to get rid of a tags
64 if ($this->href === "") {
65 $s = str_replace("</a>", "", substr($s, strpos($s, "<span")));
66 }
67 return $s;
68 }
69}
glyph(string $gl_type, string $href="")
Definition: UI.php:24
This describes a symbol.
Definition: Symbol.php:30
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26