ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
RepositoryLink.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isInterchangeableItemTrait;
32use ilLink;
33use LogicException;
36
40class RepositoryLink extends AbstractChildItem implements
45 isChild,
47{
49 use isInterchangeableItemTrait;
51
52 protected int $ref_id = 0;
53 protected string $alt_text;
54 protected string $title = '';
55
59 public function withTitle(string $title): hasTitle
60 {
61 $clone = clone($this);
62 $clone->title = $title;
63
64 return $clone;
65 }
66
67 public function getTitle(): string
68 {
69 return $this->title;
70 }
71
72 public function withAltText(string $alt_text): self
73 {
74 $clone = clone($this);
75 $clone->alt_text = $alt_text;
76
77 return $clone;
78 }
79
80 public function getAltText(): string
81 {
82 return $this->alt_text;
83 }
84
85 final public function getAction(): string
86 {
87 return ilLink::_getLink($this->ref_id);
88 }
89
90 public function withAction(string $action): hasAction
91 {
92 $clone = clone $this;
93 $clone->ref_id = (int) $action;
94
95 return $clone;
96 }
97
98 public function withRefId(int $ref_id): self
99 {
100 $clone = clone $this;
101 $clone->ref_id = $ref_id;
102
103 return $clone;
104 }
105
106 public function getSymbol(): Symbol
107 {
108 return $this->symbol;
109 }
110
111 public function getRefId(): int
112 {
113 return $this->ref_id;
114 }
115
119 public function withIsLinkToExternalAction(bool $is_external): hasAction
120 {
121 throw new LogicException("Repository-Links are always internal");
122 }
123
127 public function isLinkWithExternalAction(): bool
128 {
129 return false;
130 }
131}
This describes a symbol.
Definition: Symbol.php:30
trait hasSymbolTrait
Trait hasSymbolTrait.