19declare(strict_types=1);
25use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
46 return $this->
ui->factory()->legacy()->content(
"Cannot render item of type " . $item::class .
"");
50 $toast = $this->
ui->factory()->toast()->standard(
52 $this->getIconOrFallback($item)
55 if ($item->getDescription() !==
null) {
56 $toast = $toast->withDescription($item->getDescription());
60 if ($item->hasClosedAction()) {
62 $item->getClosedAction()->getIdentifier(),
65 $toast = $toast->withAdditionalOnLoadCode(fn(
$id):
string =>
"
66 $('#$id').on('removeToast', function() {
76 if ($item->hasShownAction()) {
78 $item->getShownAction()->getIdentifier(),
81 $toast = $toast->withAdditionalOnLoadCode(fn(
$id):
string =>
"
82 $('#$id').on('showToast', function() {
92 if ($item->hasVanishedAction()) {
94 $item->getVanishedAction()->getIdentifier(),
97 $toast = $toast->withAdditionalOnLoadCode(fn(
$id):
string =>
"
98 $('#$id').on('vanishToast', function() {
102 url: '$vanished_action'
108 foreach ($item->getAdditionalToastActions() as $toast_action) {
110 $toast_action->getIdentifier(),
113 $link = $this->
ui->factory()->link()->standard(
114 $toast_action->getTitle(),
118 $toast = $toast->withAdditionalLink($link);
127 if ($icon !==
null) {
130 return $this->
ui->factory()->symbol()->icon()->standard(
"nota", $item->
getTitle());
135 $query = http_build_query([
136 ClientNotifications::MODE => ClientNotifications::MODE_HANDLE_TOAST_ACTION,
137 ClientNotifications::ADDITIONAL_ACTION => $action,
138 ClientNotifications::ITEM_ID => $this->hash(
$id->serialize()),
141 return rtrim(ILIAS_HTTP_PATH,
"/") .
"/" . ClientNotifications::NOTIFY_ENDPOINT .
"?" . $query;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Provides fluid interface to RBAC services.
getIconOrFallback(isStandardItem $item)
__construct(protected UIServices $ui)
buildURL(string $action, IdentificationInterface $id)
getToastComponentForItem(isItem $item)
Returns the UI Component for the past item.
Interface IdentificationInterface.
getProviderIdentification()
A component is the most general form of an entity in the UI.
This describes how an icon could be modified during construction of UI.