ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
with_js_binding.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
16 function with_js_binding()
17 {
18  global $DIC;
19  $f = $DIC->ui()->factory();
20  $renderer = $DIC->ui()->renderer();
21 
22  return $renderer->render(
23  $f->button()->standard("Goto ILIAS", "#")
24  ->withOnLoadCode(function ($id) {
25  return
26  "$(\"#$id\").click(function() { alert(\"Clicked: $id\"); return false;});";
27  })
28  );
29 }
$renderer
with_js_binding()
description: > Example for rendering a standard button with JS binding
global $DIC
Definition: shib_login.php:25
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24