3 declare(strict_types=1);
    51             return $this->
renderButton($component, $default_renderer);
    59             $tpl_name = 
"tpl.primary.html";
    62             $tpl_name = 
"tpl.standard.html";
    65             $tpl_name = 
"tpl.shy.html";
    68             $tpl_name = 
"tpl.tag.html";
    71             $tpl_name = 
"tpl.bulky.html";
    76         $action = $component->getAction();
    79         if (is_string($action)) {
    80             $tpl->setCurrentBlock(
"with_data_action");
    81             $tpl->setVariable(
"ACTION", $action);
    82             $tpl->parseCurrentBlock();
    85         $label = $component->getLabel();
    86         if ($label !== null) {
    87             $tpl->setVariable(
"LABEL", $component->getLabel());
    89         if ($component->isActive()) {
    92             if (is_string($action) && $action != 
"") {
    93                 $component = $component->withAdditionalOnLoadCode(
function (
$id) use ($action) {
    94                     $action = str_replace(
"&", 
"&", $action);
    96                     return "$('#$id').on('click', function(event) {    97                                                         window.location = '$action';   104                 $component = $component->withAdditionalOnLoadCode(fn (
$id) => 
"$('#$id').click(function(e) { il.UI.button.activateLoadingAnimation('$id')});");
   107             $tpl->touchBlock(
"disabled");
   109         $aria_label = $component->getAriaLabel();
   110         if ($aria_label != null) {
   111             $tpl->setCurrentBlock(
"with_aria_label");
   112             $tpl->setVariable(
"ARIA_LABEL", $aria_label);
   113             $tpl->parseCurrentBlock();
   117             && $component->isEngageable()
   119             if ($component->isEngaged()) {
   120                 $tpl->touchBlock(
"engaged");
   121                 $aria_pressed = 
'true';
   123                 $aria_pressed = 
'false';
   127             if (!($component instanceof Bulky)) {
   128                 $tpl->setCurrentBlock(
"with_aria_pressed");
   129                 $tpl->setVariable(
"ARIA_PRESSED", $aria_pressed);
   130                 $tpl->parseCurrentBlock();
   134         $tooltip_embedding = $this->
getTooltipRenderer()->maybeGetTooltipEmbedding(...$component->getHelpTopics());
   135         if ($tooltip_embedding) {
   136             $component = $component->withAdditionalOnLoadCode($tooltip_embedding[1]);
   149         if (!$tooltip_embedding) {
   154         $tpl->setCurrentBlock(
"with_aria_describedby");
   155         $tpl->setVariable(
"ARIA_DESCRIBED_BY", $tooltip_id);
   156         $tpl->parseCurrentBlock();
   158         return $tooltip_embedding[0]($tooltip_id, $tpl->get());
   166         parent::registerResources($registry);
   167         $registry->
register(
'./src/UI/templates/js/Button/button.js');
   168         $registry->
register(
"./node_modules/moment/min/moment-with-locales.min.js");
   169         $registry->
register(
"./node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
   174         $tpl = $this->
getTemplate(
"tpl.close.html", 
true, 
true);
   177         $tpl->setVariable(
"FORCE_RENDERING", 
"");
   178         $tpl->setVariable(
"ARIA_LABEL", $this->
txt(
"close"));
   185         $tpl = $this->
getTemplate(
"tpl.minimize.html", 
true, 
true);
   186         $tpl->setVariable(
"ARIA_LABEL", $this->
txt(
"minimize"));
   193         $tpl = $this->
getTemplate(
"tpl.toggle.html", 
true, 
true);
   195         $on_action = $component->getActionOn();
   196         $off_action = $component->getActionOff();
   198         $on_url = (is_string($on_action))
   202         $off_url = (is_string($off_action))
   208         foreach ($component->getTriggeredSignals() as $s) {
   210                 "signal_id" => $s->getSignal()->getId(),
   211                 "event" => $s->getEvent(),
   212                 "options" => $s->getSignal()->getOptions()
   216         $signals = json_encode($signals);
   218         $button_status = 
'off';
   219         if ($component->isEngaged()) {
   220             $button_status = 
'on';
   223         if ($component->isActive()) {
   224             $component = $component->withAdditionalOnLoadCode(fn (
$id) => 
"$('#$id').on('click', function(event) {   225                                                 il.UI.button.handleToggleClick(event, '$id', '$on_url', '$off_url', $signals);   226                                                 return false; // stop event propagation   228             $tpl->setCurrentBlock(
"with_on_off_label");
   229             $tpl->setVariable(
"ON_LABEL", $this->
txt(
"toggle_on"));
   230             $tpl->setVariable(
"OFF_LABEL", $this->
txt(
"toggle_off"));
   231             $tpl->parseCurrentBlock();
   233             $tpl->touchBlock(
"disabled");
   234             $button_status = 
'unavailable';
   237         $tpl->touchBlock($button_status);
   239         $label = $component->getLabel();
   240         if (!empty($label)) {
   241             $tpl->setCurrentBlock(
"with_label");
   242             $tpl->setVariable(
"LABEL", $label);
   243             $tpl->parseCurrentBlock();
   245         $aria_label = $component->getAriaLabel();
   246         if ($aria_label != null) {
   247             $tpl->setCurrentBlock(
"with_aria_label");
   248             $tpl->setVariable(
"ARIA_LABEL", $aria_label);
   249             $tpl->parseCurrentBlock();
   252         $tooltip_embedding = $this->
getTooltipRenderer()->maybeGetTooltipEmbedding(...$component->getHelpTopics());
   253         if ($tooltip_embedding) {
   254             $component = $component->withAdditionalOnLoadCode($tooltip_embedding[1]);
   256             $tpl->setCurrentBlock(
"with_aria_describedby");
   257             $tpl->setVariable(
"ARIA_DESCRIBED_BY", $tooltip_id);
   258             $tpl->parseCurrentBlock();
   261             return $tooltip_embedding[0]($tooltip_id, $tpl->get());
   280         $def = $component->getDefault();
   282         for ($i = 1; $i <= 12; $i++) {
   283             $this->
toJS(array(
"month_" . str_pad((
string) $i, 2, 
"0", STR_PAD_LEFT) . 
"_short"));
   286         $tpl = $this->
getTemplate(
"tpl.month.html", 
true, 
true);
   288         $month = explode(
"-", $def);
   289         $tpl->setVariable(
"DEFAULT_LABEL", $this->
txt(
"month_" . str_pad($month[0], 2, 
"0", STR_PAD_LEFT) . 
"_short") . 
" " . $month[1]);
   290         $tpl->setVariable(
"DEF_DATE", $month[0] . 
"/1/" . $month[1]);
   292         $lang_key = in_array($this->
getLangKey(), array(
"ar", 
"bg", 
"cs", 
"da", 
"de", 
"el", 
"en", 
"es", 
"et", 
"fa", 
"fr", 
"hu", 
"it",
   293             "ja", 
"ka", 
"lt", 
"nl", 
"pl", 
"pt", 
"ro", 
"ru", 
"sk", 
"sq", 
"sr", 
"tr", 
"uk", 
"vi", 
"zh"))
   296         if ($lang_key == 
"zh") {
   299         $tpl->setVariable(
"LANG", $lang_key);
   301         $component = $component->withAdditionalOnLoadCode(fn (
$id) => 
"il.UI.button.initMonth('$id');");
   304         $tpl->setVariable(
"ID", 
$id);
   311         $tpl->
touchBlock(
'rel_' . $component->getRelevance());
   313         $classes = trim(join(
' ', $component->getClasses()));
   314         if ($classes !== 
'') {
   318         $bgcol = $component->getBackgroundColor();
   322         $forecol = $component->getForegroundColor();
   333         $renderer = $default_renderer->withAdditionalContext($component);
   334         $tpl->
setVariable(
"ICON_OR_GLYPH", $renderer->render($component->getIconOrGlyph()));
   335         $label = $component->getLabel();
   336         if ($label !== null) {
   340         $aria_role = $component->getAriaRole();
   341         if ($aria_role != null) {
   346         if ($component->isEngageable()) {
   352                 if ($component->isEngaged()) {
 Registry for resources required by rendered output like Javascript or CSS. 
 
checkComponent(Component $component)
Check if a given component fits this renderer and throw  if that is not the case. ...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
txt(string $id)
Get a text from the language file. 
 
toJS($key)
Add language var to client side (il.Language) 
 
setCurrentBlock(string $name)
Set the block to work on. 
 
createId()
Get a fresh unique id. 
 
setVariable(string $name, $value)
Set a variable in the current block. 
 
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for. 
 
register(string $name)
Add a dependency. 
 
parseCurrentBlock()
Parse the block that is currently worked on. 
 
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer. 
 
touchBlock(string $name)
Touch a block without working further on it. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
getLangKey()
Get current language key. 
 
Base class for all component renderers. 
 
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.