ILIAS  release_8 Revision v8.24
with_additional_on_load_code.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
13{
14 //Loading factories
15 global $DIC;
16 $f = $DIC->ui()->factory();
17 $renderer = $DIC->ui()->renderer();
18
19 //Generating and rendering the image and modal
20 $image = $f->image()->standard(
21 "src/UI/examples/Image/HeaderIconLarge.svg",
22 "Thumbnail Example"
23 )->withAction("#")
24 ->withAdditionalOnLoadCode(function ($id) {
25 return "$('#$id').click(function(e) { e.preventDefault(); alert('Image Onload Code')});";
26 });
27
28 $html = $renderer->render($image);
29
30 return $html;
31}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $DIC
Definition: feed.php:28
with_additional_on_load_code()
Example showing how JS-Code can be attached to images.