ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Popover.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ILIAS\UI\Component as C;
27 
34 abstract class Popover implements C\Popover\Popover
35 {
36  use ComponentHelper;
38 
39  protected string $title = '';
40  protected string $position = self::POS_AUTO;
41  protected string $ajax_content_url = '';
42  protected C\Signal $show_signal;
43  protected C\ReplaceContentSignal $replace_content_signal;
45  protected bool $fixed_position = false;
46 
47  public function __construct(SignalGeneratorInterface $signal_generator)
48  {
49  $this->signal_generator = $signal_generator;
50  $this->initSignals();
51  }
52 
56  public function getTitle(): string
57  {
58  return $this->title;
59  }
60 
64  public function getPosition(): string
65  {
66  return $this->position;
67  }
68 
72  public function getAsyncContentUrl(): string
73  {
75  }
76 
81  {
82  $clone = clone $this;
83  $clone->position = self::POS_VERTICAL;
84  return $clone;
85  }
86 
91  {
92  $clone = clone $this;
93  $clone->position = self::POS_HORIZONTAL;
94  return $clone;
95  }
96 
100  public function withAsyncContentUrl(string $url): C\Popover\Popover
101  {
102  $clone = clone $this;
103  $clone->ajax_content_url = $url;
104  return $clone;
105  }
106 
110  public function withTitle(string $title): C\Popover\Popover
111  {
112  $clone = clone $this;
113  $clone->title = $title;
114  return $clone;
115  }
116 
120  public function withResetSignals(): C\Popover\Popover
121  {
122  $clone = clone $this;
123  $clone->initSignals();
124  return $clone;
125  }
126 
130  public function getShowSignal(): C\Signal
131  {
132  return $this->show_signal;
133  }
134 
139  {
141  }
142 
146  protected function initSignals()
147  {
148  $this->show_signal = $this->signal_generator->create();
150  $signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\ReplaceContentSignal");
151  $this->replace_content_signal = $signal;
152  }
153 
157  public function withFixedPosition(): C\Popover\Popover
158  {
159  $this->fixed_position = true;
160 
161  return $this;
162  }
163 
167  public function isFixedPosition(): bool
168  {
169  return $this->fixed_position;
170  }
171 }
__construct(SignalGeneratorInterface $signal_generator)
Definition: Popover.php:47
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
$url
Definition: shib_logout.php:66
This signal replaces the content of a component by ajax.
C ReplaceContentSignal $replace_content_signal
Definition: Popover.php:43
SignalGeneratorInterface $signal_generator
Definition: Popover.php:44