ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTLocalizedTextPresentationBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
25{
26 public function __construct(ilADT $a_adt)
27 {
28 parent::__construct($a_adt);
29 }
30
31 protected function isValidADT(ilADT $a_adt): bool
32 {
33 return $a_adt instanceof ilADTLocalizedText;
34 }
35
36 public function getHTML(): string
37 {
38 if (!$this->getADT()->isNull()) {
39 return $this->decorate(nl2br($this->getTextForCurrentLanguageIfAvailable()));
40 }
41 return '';
42 }
43
44 public function getSortable(): string
45 {
46 if (!$this->getADT()->isNull()) {
47 return strtolower($this->getTextForCurrentLanguageIfAvailable());
48 }
49 return '';
50 }
51
52 private function getTextForCurrentLanguageIfAvailable(): string
53 {
54 $language = $this->lng->getLangKey();
55 if (!$this->getADT()->getCopyOfDefinition()->getMultilingualValueSupport()) {
56 $language = $this->getADT()->getCopyOfDefinition()->getDefaultLanguage();
57 }
58 return $this->getADT()->getTextForLanguage($language);
59 }
60}
Class ilADTLocalizedText.
ADT base class.
Definition: class.ilADT.php:26
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc