ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
hasActionTrait.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ILIAS\Data\URI;
25 
29 trait hasActionTrait
30 {
31  protected URI|Signal $action;
32 
33  protected bool $open_in_new_viewport = false;
34 
35  public function withAction(URI|Signal $action): self
36  {
37  $clone = clone $this;
38  $clone->action = $action;
39  return $clone;
40  }
41 
42  public function getAction(): URI|Signal
43  {
44  return $this->action;
45  }
46 
47  public function withOpenInNewViewport(bool $state)
48  {
49  $clone = clone $this;
50  $clone->open_in_new_viewport = $state;
51  return $clone;
52  }
53 
54  public function mustOpenInNewViewport(): bool
55  {
56  if ($this->action instanceof Signal) {
57  return false;
58  }
60  }
61 }