ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\UI\examples\Image\Standard Namespace Reference

Functions

 base ()
 
 decorative ()
 
 with_additional_on_load_code ()
 
 with_signal_action ()
 
 with_string_action ()
 

Function Documentation

◆ base()

ILIAS\UI\examples\Image\Standard\base ( )

description: > Base example for rendering an Image.

expected output: > ILIAS shows a rendered image with a grey background. While changing the size of the browser window the

image won't decrease in size. If the element gets analyzed a text entry for "alt" is shown within the HTML.

Definition at line 33 of file base.php.

34{
35 //Loading factories
36 global $DIC;
37 $f = $DIC->ui()->factory();
38 $renderer = $DIC->ui()->renderer();
39
40 //Generating and rendering the image
41 $image = $f->image()->standard(
42 "assets/ui-examples/images/Image/HeaderIconLarge.svg",
43 "Thumbnail Example"
44 );
45 $html = $renderer->render($image);
46
47 return $html;
48}
$renderer
global $DIC
Definition: shib_login.php:26

References $DIC, Vendor\Package\$f, and $renderer.

◆ decorative()

ILIAS\UI\examples\Image\Standard\decorative ( )

description: > Base example for rendering an Image with only decorative purpose (see accessibility rules in images)

expected output: > ILIAS shows a rendered image with a grey background. While changing the size of the browser window the

image won't decrease in size. If the element gets analyzed no text entry for "alt" is shown within the HTML.

Definition at line 34 of file decorative.php.

35{
36 //Loading factories
37 global $DIC;
38 $f = $DIC->ui()->factory();
39 $renderer = $DIC->ui()->renderer();
40
41 //Generating and rendering the image
42 $image = $f->image()->standard(
43 "assets/ui-examples/images/Image/HeaderIconLarge.svg",
44 ""
45 );
46 $html = $renderer->render($image);
47
48 return $html;
49}

References $DIC, Vendor\Package\$f, and $renderer.

◆ with_additional_on_load_code()

ILIAS\UI\examples\Image\Standard\with_additional_on_load_code ( )

description: > Example showing how JS-Code can be attached to images.

expected output: >

ILIAS shows an image. An alert pops up as soon as the image is clicked.

Definition at line 32 of file with_additional_on_load_code.php.

33{
34 //Loading factories
35 global $DIC;
36 $f = $DIC->ui()->factory();
37 $renderer = $DIC->ui()->renderer();
38
39 //Generating and rendering the image and modal
40 $image = $f->image()->standard(
41 "assets/ui-examples/images/Image/HeaderIconLarge.svg",
42 "Thumbnail Example"
43 )->withAction("#")
44 ->withAdditionalOnLoadCode(function ($id) {
45 return "$('#$id').click(function(e) { e.preventDefault(); alert('Image Onload Code')});";
46 });
47
48 $html = $renderer->render($image);
49
50 return $html;
51}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $DIC, Vendor\Package\$f, $id, and $renderer.

◆ with_signal_action()

ILIAS\UI\examples\Image\Standard\with_signal_action ( )

description: > Example for rendering an Image with a signal as action

expected output: >

Clicking onto the rendered image will open a modal.

Definition at line 32 of file with_signal_action.php.

33{
34 //Loading factories
35 global $DIC;
36 $f = $DIC->ui()->factory();
37 $renderer = $DIC->ui()->renderer();
38
39 //Generating and rendering the image and modal
40 $image_in_modal = $f->image()->standard(
41 "assets/ui-examples/images/Image/mountains.jpg",
42 ""
43 );
44 $page = $f->modal()->lightboxImagePage($image_in_modal, "Nice view");
45 $modal = $f->modal()->lightbox($page);
46
47 $image = $f->image()->standard(
48 "assets/ui-examples/images/Image/HeaderIconLarge.svg",
49 "Thumbnail Example"
50 )->withAction($modal->getShowSignal());
51
52 $html = $renderer->render([$image, $modal]);
53
54 return $html;
55}

References $DIC, Vendor\Package\$f, and $renderer.

◆ with_string_action()

ILIAS\UI\examples\Image\Standard\with_string_action ( )

description: > Example for rendering an Image with a string as action

expected output: >

Clicking onto the rendered image will open a new tab to ilias.de.

Definition at line 32 of file with_string_action.php.

33{
34 //Loading factories
35 global $DIC;
36 $f = $DIC->ui()->factory();
37 $renderer = $DIC->ui()->renderer();
38
39 //Generating and rendering the image and modal
40 $image = $f->image()->standard(
41 "assets/ui-examples/images/Image/HeaderIconLarge.svg",
42 "Thumbnail Example"
43 )->withAction("https://www.ilias.de");
44
45 $html = $renderer->render($image);
46
47 return $html;
48}

References $DIC, Vendor\Package\$f, and $renderer.