ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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;
34
38class RepositoryLink extends AbstractChildItem implements
44{
46 use isInterchangeableItemTrait;
47
48 protected int $ref_id = 0;
49 protected string $alt_text;
50 protected string $title = '';
51
56 public function withTitle(string $title): hasTitle
57 {
58 $clone = clone($this);
59 $clone->title = $title;
60
61 return $clone;
62 }
63
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
83 public function getAltText(): string
84 {
85 return $this->alt_text;
86 }
87
91 final public function getAction(): string
92 {
93 return ilLink::_getLink($this->ref_id);
94 }
95
100 public function withAction(string $action): hasAction
101 {
102 $clone = clone $this;
103 $clone->ref_id = (int) $action;
104
105 return $clone;
106 }
107
108 public function withRefId(int $ref_id): self
109 {
110 $clone = clone $this;
111 $clone->ref_id = $ref_id;
112
113 return $clone;
114 }
115
116 public function getSymbol(): Symbol
117 {
118 return $this->symbol;
119 }
120
124 public function getRefId(): int
125 {
126 return $this->ref_id;
127 }
128
132 public function withIsLinkToExternalAction(bool $is_external): hasAction
133 {
134 throw new LogicException("Repository-Links are always internal");
135 }
136
140 public function isLinkWithExternalAction(): bool
141 {
142 return false;
143 }
144}
This describes a symbol.
Definition: Symbol.php:30
trait hasSymbolTrait
Trait hasSymbolTrait.