ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
RepositoryLink.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
32 use ilLink;
33 use LogicException;
36 
40 class RepositoryLink extends AbstractChildItem implements
41  hasTitle,
42  hasAction,
43  hasSymbol,
45  isChild
46 {
47  use hasSymbolTrait;
49 
50  protected int $ref_id = 0;
51  protected string $alt_text;
52  protected string $title = '';
53 
58  public function withTitle(string $title): hasTitle
59  {
60  $clone = clone($this);
61  $clone->title = $title;
62 
63  return $clone;
64  }
65 
69  public function getTitle(): string
70  {
71  return $this->title;
72  }
73 
74  public function withAltText(string $alt_text): self
75  {
76  $clone = clone($this);
77  $clone->alt_text = $alt_text;
78 
79  return $clone;
80  }
81 
85  public function getAltText(): string
86  {
87  return $this->alt_text;
88  }
89 
93  final public function getAction(): string
94  {
95  return ilLink::_getLink($this->ref_id);
96  }
97 
102  public function withAction(string $action): hasAction
103  {
104  $clone = clone $this;
105  $clone->ref_id = (int) $action;
106 
107  return $clone;
108  }
109 
110  public function withRefId(int $ref_id): self
111  {
112  $clone = clone $this;
113  $clone->ref_id = $ref_id;
114 
115  return $clone;
116  }
117 
118  public function getSymbol(): Symbol
119  {
120  return $this->symbol;
121  }
122 
126  public function getRefId(): int
127  {
128  return $this->ref_id;
129  }
130 
134  public function withIsLinkToExternalAction(bool $is_external): hasAction
135  {
136  throw new LogicException("Repository-Links are always internal");
137  }
138 
142  public function isLinkWithExternalAction(): bool
143  {
144  return false;
145  }
146 }
This describes a symbol.
Definition: Symbol.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Complex.php:21
trait hasSymbolTrait
Trait hasSymbolTrait.