ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTExternalLinkPresentationBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
33 protected function isValidADT(ilADT $a_adt): bool
34 {
35 return $a_adt instanceof ilADTExternalLink;
36 }
37
42 public function getHTML(): string
43 {
44 if ($this->getADT()->isNull()) {
45 return '';
46 }
47
48 $presentation_value = $this->getADT()->getUrl();
49 $presentation_clickable = ilUtil::makeClickable($presentation_value);
50
51 if (!strlen((string) $this->getADT()->getTitle())) {
52 return $this->decorate($presentation_clickable);
53 }
54
55 /*
56 * BT 35874: Until the refinery (or some other service) can provide
57 * links with titles, we have to do some surgery here.
58 */
59 $presentation_clickable = preg_replace(
60 '/>.*<\/a>/',
61 '>' . $this->getADT()->getTitle() . '</a>',
62 $presentation_clickable
63 );
64 return $this->decorate($presentation_clickable);
65 }
66
71 public function getSortable()
72 {
73 if (!$this->getADT()->isNull()) {
74 return $this->getADT()->getUrl();
75 }
76 return '';
77 }
78}
ADT presentation bridge base class.
ADT base class.
Definition: class.ilADT.php:26
static makeClickable(string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)