ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\UI\examples\Image\Standard Namespace Reference

Functions

 base ()
 

description: > Base example for rendering an Image. More...

 
 decorative ()
 

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

 
 with_additional_on_load_code ()
 

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

 
 with_signal_action ()
 

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

 
 with_string_action ()
 

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

 

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.

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

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

◆ 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.

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

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 }
$renderer
global $DIC
Definition: shib_login.php:26

◆ 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.

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

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 }
$renderer
global $DIC
Definition: shib_login.php:26
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ 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.

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

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 }
$renderer
global $DIC
Definition: shib_login.php:26

◆ 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.

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

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 }
$renderer
global $DIC
Definition: shib_login.php:26