ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
DropdownBuilder.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 {
28  protected array $items = [];
29 
30  public function __construct(
31  private \ILIAS\UI\Factory $ui_f,
32  private \ILIAS\UI\Renderer $ui_r,
33  private \ilLanguage $lng
34  ) {
35  }
36 
37  public function withItem(
38  string $label_lang_var,
39  string $url,
40  bool $condition = true
41  ) {
42  if (! $condition) {
43  return $this;
44  }
45  $clone = clone $this;
46  $clone->items[] = $this->ui_f->button()->shy(
47  $items[] = $this->lng->txt($label_lang_var),
48  $url
49  );
50  return $clone;
51  }
52 
53  public function get(): string
54  {
55  return $this->ui_r->render(
56  $this->ui_f->dropdown()->standard($this->items)
57  ->withLabel($this->lng->txt('actions'))
58  );
59  }
60 }
Class ChatMainBarProvider .
withItem(string $label_lang_var, string $url, bool $condition=true)
__construct(private \ILIAS\UI\Factory $ui_f, private \ILIAS\UI\Renderer $ui_r, private \ilLanguage $lng)
This is to construct/collect the entries (=Links) of a row&#39;s action-dropdown.
$lng
$url
Definition: ltiregstart.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...