ILIAS  release_7 Revision v7.30-3-g800a261c036
with_additional_on_load_code.php
Go to the documentation of this file.
1<?php
8{
9 //Loading factories
10 global $DIC;
11 $f = $DIC->ui()->factory();
12 $renderer = $DIC->ui()->renderer();
13
14 //Genarating and rendering the image and modal
15 $image = $f->image()->standard(
16 "src/UI/examples/Image/HeaderIconLarge.svg",
17 "Thumbnail Example"
18 )->withAction("#")
19 ->withAdditionalOnLoadCode(function ($id) {
20 return "$('#$id').click(function(e) { e.preventDefault(); alert('Image Onload Code')});";
21 });
22
23 $html = $renderer->render($image);
24
25 return $html;
26}
An exception for terminatinating execution or to throw for unit testing.
global $DIC
Definition: goto.php:24
with_additional_on_load_code()
Example showing how JS-Code can be attached to images.