ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Modal.php
Go to the documentation of this file.
1<?php
3
4use ILIAS\UI\Component as Component;
10
16abstract class Modal implements Component\Modal\Modal
17{
20 use Triggerer;
21
26
30 protected $show_signal;
31
35 protected $close_signal;
36
40 protected $async_render_url = '';
41
45 protected $close_with_keyboard = true;
46
51 {
52 $this->signal_generator = $signal_generator;
53 $this->initSignals();
54 }
55
59 public function getAsyncRenderUrl()
60 {
62 }
63
67 public function withAsyncRenderUrl($url)
68 {
69 $this->checkStringArg('url', $url);
70 $clone = clone $this;
71 $clone->async_render_url = $url;
72 return $clone;
73 }
74
79 {
80 $clone = clone $this;
81 $clone->close_with_keyboard = (bool) $state;
82 return $clone;
83 }
84
88 public function getCloseWithKeyboard()
89 {
91 }
92
93
97 public function getShowSignal()
98 {
99 return $this->show_signal;
100 }
101
105 public function getCloseSignal()
106 {
107 return $this->close_signal;
108 }
109
113 public function withResetSignals()
114 {
115 $clone = clone $this;
116 $clone->initSignals();
117 return $clone;
118 }
119
123 public function withOnLoad(Signal $signal)
124 {
125 return $this->addTriggeredSignal($signal, 'ready');
126 }
127
131 public function appendOnLoad(Signal $signal)
132 {
133 return $this->appendTriggeredSignal($signal, 'ready');
134 }
135
136
140 protected function initSignals()
141 {
142 $this->show_signal = $this->signal_generator->create();
143 $this->close_signal = $this->signal_generator->create();
144 }
145}
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
An exception for terminatinating execution or to throw for unit testing.
getCloseSignal()
Get the signal to close this modal in the frontend.Signal
Definition: Modal.php:105
withCloseWithKeyboard($state)
Get a modal like this which can or cannot be closed by keyboard (ESC), depending on the given $state....
Definition: Modal.php:78
withOnLoad(Signal $signal)
Trigger a signal of another component on load.$this
Definition: Modal.php:123
__construct(SignalGeneratorInterface $signal_generator)
Definition: Modal.php:50
withAsyncRenderUrl($url)
Get a modal like this who's content is rendered via ajax by the given $url before the modal is shown....
Definition: Modal.php:67
withResetSignals()
Get a component like this but reset (regenerate) its signals.$this
Definition: Modal.php:113
getAsyncRenderUrl()
Get the url returning the rendered modal, if the modals content should be rendered via ajax....
Definition: Modal.php:59
appendOnLoad(Signal $signal)
Get a component like this, triggering a signal of another component on load.In contrast to withOnLoad...
Definition: Modal.php:131
getShowSignal()
Get the signal to show this modal in the frontend.Signal
Definition: Modal.php:97
initSignals()
Set the show and close signals for this modal.
Definition: Modal.php:140
getCloseWithKeyboard()
Returns if this modal can be closed with the keyboard (ESC key)bool
Definition: Modal.php:88
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
appendTriggeredSignal(Component\Signal $signal, $event)
Append a triggered signal to other signals of the same event.
Definition: Triggerer.php:29
addTriggeredSignal(Component\Signal $signal, $event)
Add a triggered signal, replacing any other signals registered on the same event.
Definition: Triggerer.php:46
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
trait ComponentHelper
Provides common functionality for component implementations.
$url