ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTPresentationBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 protected ilADT $adt;
32 protected $decorator;
33 protected ilLanguage $lng;
34
35 public function __construct(ilADT $a_adt)
36 {
37 global $DIC;
38
39 $this->lng = $DIC->language();
40
41 $this->setADT($a_adt);
42 }
43
44 abstract protected function isValidADT(ilADT $a_adt): bool;
45
46 protected function setADT(ilADT $a_adt): void
47 {
48 if (!$this->isValidADT($a_adt)) {
49 throw new InvalidArgumentException('ADTPresentationBridge Type mismatch.');
50 }
51 $this->adt = $a_adt;
52 }
53
54 public function getADT(): ?ilADT
55 {
56 return $this->adt;
57 }
58
59 public function getList(): string
60 {
61 return $this->getHTML();
62 }
63
64 abstract public function getHTML(): string;
65
70 abstract public function getSortable();
71
78 public function setDecoratorCallBack(?array $a_callback): void
79 {
80 $this->decorator = $a_callback;
81 }
82
88 protected function decorate($a_value)
89 {
90 if (is_callable($this->decorator)) {
91 $a_value = call_user_func($this->decorator, $a_value);
92 }
93 return $a_value;
94 }
95}
ADT presentation bridge base class.
getSortable()
Get sortable value presentation.
setDecoratorCallBack(?array $a_callback)
Takes as input an array consisting of the object that the method that should be called back to belong...
isValidADT(ilADT $a_adt)
ADT base class.
Definition: class.ilADT.php:26
language handling
global $DIC
Definition: shib_login.php:26