ILIAS  release_8 Revision v8.24
class.ilADTExternalLinkPresentationBridge.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ADT base class.
Definition: class.ilADT.php:12
static makeClickable(string $a_text, bool $detectGotoLinks=false)