diff --git a/src/UI/Component/Toast/Container.php b/src/UI/Component/Toast/Container.php new file mode 100644 index 000000000000..e0e6bcb0dfb6 --- /dev/null +++ b/src/UI/Component/Toast/Container.php @@ -0,0 +1,21 @@ +signal_generator); } + + public function container() : Container + { + throw new \ILIAS\UI\NotImplementedException(); + } } diff --git a/src/UI/examples/Toast/Container/base.php b/src/UI/examples/Toast/Container/base.php new file mode 100644 index 000000000000..01afe8d0be36 --- /dev/null +++ b/src/UI/examples/Toast/Container/base.php @@ -0,0 +1,10 @@ +ui()->factory()->toast()->container(); + return $DIC->ui()->renderer()->render($tc); +} diff --git a/src/UI/examples/Toast/Container/with_multiple_toasts.php b/src/UI/examples/Toast/Container/with_multiple_toasts.php new file mode 100644 index 000000000000..c3e9cf5a1444 --- /dev/null +++ b/src/UI/examples/Toast/Container/with_multiple_toasts.php @@ -0,0 +1,27 @@ +ui()->factory()->toast()->container() + ->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example 1', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) + )->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example 2', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) + )->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example 3', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) + ); + + return $DIC->ui()->renderer()->render($tc); +} diff --git a/src/UI/examples/Toast/Container/with_toast.php b/src/UI/examples/Toast/Container/with_toast.php new file mode 100644 index 000000000000..66ddbbdc235d --- /dev/null +++ b/src/UI/examples/Toast/Container/with_toast.php @@ -0,0 +1,16 @@ +ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) + ); + + return $DIC->ui()->renderer()->render($tc); +} diff --git a/src/UI/examples/Toast/Standard/base.php b/src/UI/examples/Toast/Standard/base.php index 1f8d3fada5cf..1e62d1ca0fda 100644 --- a/src/UI/examples/Toast/Standard/base.php +++ b/src/UI/examples/Toast/Standard/base.php @@ -2,15 +2,15 @@ namespace ILIAS\UI\examples\Toast\Standard; -/** - * Base - */ function base() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - 'Example', - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) ); - return $DIC->ui()->renderer()->render($toast); + + return $DIC->ui()->renderer()->render($tc); } diff --git a/src/UI/examples/Toast/Standard/with_action.php b/src/UI/examples/Toast/Standard/with_action.php index 3db03e138a30..95ecf0640056 100644 --- a/src/UI/examples/Toast/Standard/with_action.php +++ b/src/UI/examples/Toast/Standard/with_action.php @@ -2,15 +2,14 @@ namespace ILIAS\UI\examples\Toast\Standard; -/** - * With a action on vanishing. (Does not provide any visual representation by itself) - */ function with_action() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - 'Example', - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') - )->withAction('https://www.ilias.de'); - return $DIC->ui()->renderer()->render($toast); + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + )->withAction('https://www.ilias.de') + ); + return $DIC->ui()->renderer()->render($tc); } diff --git a/src/UI/examples/Toast/Standard/with_additional_links.php b/src/UI/examples/Toast/Standard/with_additional_links.php index b5f7c9a3f210..343f06439fa5 100644 --- a/src/UI/examples/Toast/Standard/with_additional_links.php +++ b/src/UI/examples/Toast/Standard/with_additional_links.php @@ -5,12 +5,13 @@ function with_additional_links() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - 'Example', - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Example') - ) - ->withAdditionalLink($DIC->ui()->factory()->link()->standard('ILIAS', 'https://www.ilias.de')) - ->withAdditionalLink($DIC->ui()->factory()->link()->standard('GitHub', 'https://www.github.com')) - ; - return $DIC->ui()->renderer()->render($toast); + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Example') + ) + ->withAdditionalLink($DIC->ui()->factory()->link()->standard('ILIAS', 'https://www.ilias.de')) + ->withAdditionalLink($DIC->ui()->factory()->link()->standard('GitHub', 'https://www.github.com')) + ); + return $DIC->ui()->renderer()->render($tc); } diff --git a/src/UI/examples/Toast/Standard/with_description.php b/src/UI/examples/Toast/Standard/with_description.php index 3af2f295bdf1..e4c07e2ad75a 100644 --- a/src/UI/examples/Toast/Standard/with_description.php +++ b/src/UI/examples/Toast/Standard/with_description.php @@ -5,9 +5,11 @@ function with_description() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - 'Example', - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') - )->withDescription('This is an example description.'); - return $DIC->ui()->renderer()->render($toast); + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + )->withDescription('This is an example description.') + ); + return $DIC->ui()->renderer()->render($tc); } diff --git a/src/UI/examples/Toast/Standard/with_link_title.php b/src/UI/examples/Toast/Standard/with_link_title.php index 0cc72db08d12..5e6c9cbe55ae 100644 --- a/src/UI/examples/Toast/Standard/with_link_title.php +++ b/src/UI/examples/Toast/Standard/with_link_title.php @@ -5,9 +5,11 @@ function with_link_title() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - $DIC->ui()->factory()->link()->standard('Example', 'https://www.ilias.de'), - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + $DIC->ui()->factory()->link()->standard('Example', 'https://www.ilias.de'), + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + ) ); - return $DIC->ui()->renderer()->render($toast); + return $DIC->ui()->renderer()->render($tc); } diff --git a/src/UI/examples/Toast/Standard/with_long_description.php b/src/UI/examples/Toast/Standard/with_long_description.php index 4d2a323e9563..d122c420fd6d 100644 --- a/src/UI/examples/Toast/Standard/with_long_description.php +++ b/src/UI/examples/Toast/Standard/with_long_description.php @@ -5,17 +5,19 @@ function with_long_description() : string { global $DIC; - $toast = $DIC->ui()->factory()->toast()->standard( - 'Example', - $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') - )->withDescription( - 'This is an example description which is very long to provide a representative view of the object when it has ' . - 'to occupy enough space to show a very long toast. This may not be the favorable way of displaying a toast, ' . - 'since toast are assumed to be readable in a short time due to the temporary visibility, therefore they only ' . - 'should contain short description which can be read withing seconds. But even if this long description softly ' . - 'violates the concepts of toast itself due to its long character it still provides a good view on the ' . - 'scalability of the object and could therefore be called to proof its responsivity which confirms its benefit ' . - 'as an example in spite of its unnatural form and missing usecase for productive systems' + $tc = $DIC->ui()->factory()->toast()->container()->withAdditionalToast( + $DIC->ui()->factory()->toast()->standard( + 'Example', + $DIC->ui()->factory()->symbol()->icon()->standard('info', 'Test') + )->withDescription( + 'This is an example description which is very long to provide a representative view of the object when it has ' . + 'to occupy enough space to show a very long toast. This may not be the favorable way of displaying a toast, ' . + 'since toast are assumed to be readable in a short time due to the temporary visibility, therefore they only ' . + 'should contain short description which can be read withing seconds. But even if this long description softly ' . + 'violates the concepts of toast itself due to its long character it still provides a good view on the ' . + 'scalability of the object and could therefore be called to proof its responsivity which confirms its benefit ' . + 'as an example in spite of its unnatural form and missing usecase for productive systems' + ) ); - return $DIC->ui()->renderer()->render($toast); + return $DIC->ui()->renderer()->render($tc); }