19 declare(strict_types=1);
67 if ($closure ===
null) {
98 [self::ACTION_SHOWN, self::ACTION_CLOSED, self::ACTION_VANISHED],
101 throw new \InvalidArgumentException(
102 'You cannot use the reserved identifiers shown, closed or vanished for additional actions' 109 throw new \InvalidArgumentException(
110 'You cannot use the same identifier twice' 114 $clone = clone $this;
115 $clone->additional_actions[] = $action;
126 $actions = array_filter($actions, fn(?
ToastAction $action):
bool => $action !==
null);
138 $clone = clone $this;
139 $clone->icon = $icon;
150 return $this->provider_identification;
155 $clone = clone $this;
172 return $this->handle_shown !==
null;
177 $clone = clone $this;
194 return $this->handle_closed !==
null;
199 $clone = clone $this;
202 self::ACTION_VANISHED,
203 self::ACTION_VANISHED
216 return $this->handle_vanished !==
null;
getClosedAction()
Get the callable to be executed, when this specific item is closed.
withClosedCallable(\Closure $handle_closed)
Set the callable to be executed, when this specific item is closed by clicking the X button or after ...
hasClosedAction()
Get whether there are any callables to be executed the Toast is closed.
withAdditionToastAction(ToastAction $action)
A ToastAction leads into the rendered toast to a link that can be clicked by the user.
Interface IdentificationInterface.
ToastAction $handle_shown
Callable to be executed, if the notification center has been opened.
__construct(protected IdentificationInterface $provider_identification, protected ToastRenderer $renderer, protected string $title, protected ?Icon $icon=null)
getProviderIdentification()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getAdditionalToastActions()
ToastAction $handle_vanished
Callable to be executed, if this specific item has vanished.
withShownCallable(\Closure $handle_shown)
Set the callable to be executed, when the toast is shown.
hasVanishedAction()
Get whether there are any callables to be executed the Toast has vanished.
getVanishedAction()
Get the callable to be executed, when this specific item has vanished.
getShownAction()
Get the callable to be executed, when the test is shown in GUI.
ToastAction $handle_closed
Callable to be executed, if this specific item has been closed.
array $additional_actions
withVanishedCallable(\Closure $handle_vanished)
Set the callable to be executed, when this specific item is closed vanishing.
withDescription(string $description)
packClosure(?\Closure $closure, string $identifier, string $title)