ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
RepositoryLink.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
33 use ilLink;
34 use LogicException;
35 
42 class RepositoryLink extends AbstractChildItem implements
43  hasTitle,
44  hasAction,
45  hasSymbol,
47  isChild
48 {
49  use hasSymbolTrait;
52 
53  protected int $ref_id = 0;
54  protected string $alt_text;
55  protected string $title = '';
56 
61  public function withTitle(string $title): hasTitle
62  {
63  $clone = clone($this);
64  $clone->title = $title;
65 
66  return $clone;
67  }
68 
72  public function getTitle(): string
73  {
74  return $this->title;
75  }
76 
77  public function withAltText(string $alt_text): self
78  {
79  $clone = clone($this);
80  $clone->alt_text = $alt_text;
81 
82  return $clone;
83  }
84 
88  public function getAltText(): string
89  {
90  return $this->alt_text;
91  }
92 
96  final public function getAction(): string
97  {
98  return ilLink::_getLink($this->ref_id);
99  }
100 
105  public function withAction(string $action): hasAction
106  {
107  $clone = clone $this;
108  $clone->ref_id = (int) $action;
109 
110  return $clone;
111  }
112 
113  public function withRefId(int $ref_id): self
114  {
115  $clone = clone $this;
116  $clone->ref_id = $ref_id;
117 
118  return $clone;
119  }
120 
121  public function getSymbol(): Symbol
122  {
123  return $this->symbol;
124  }
125 
129  public function getRefId(): int
130  {
131  return $this->ref_id;
132  }
133 
137  public function withIsLinkToExternalAction(bool $is_external): hasAction
138  {
139  throw new LogicException("Repository-Links are always internal");
140  }
141 
145  public function isLinkWithExternalAction(): bool
146  {
147  return false;
148  }
149 }
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
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:32
trait hasSymbolTrait
Trait hasSymbolTrait.