ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
Boolean.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29
30class Boolean extends Column implements C\Boolean
31{
32 public function __construct(
33 protected Language $lng,
34 string $title,
35 protected string|Icon|Glyph $true_option,
36 protected string|Icon|Glyph $false_option
37 ) {
39 }
40
41 public function format($value): string|Icon|Glyph
42 {
43 $this->checkBoolArg('value', $value);
44 return $value ? $this->true_option : $this->false_option;
45 }
46
50 public function getOrderingLabels(): array
51 {
52 $column_value_true = $this->format(true);
53 $column_value_false = $this->format(false);
54 if($column_value_true instanceof Symbol) {
55 $column_value_true = $column_value_true->getLabel();
56 }
57 if($column_value_false instanceof Symbol) {
58 $column_value_false = $column_value_false->getLabel();
59 }
60 return [
61 $this->asc_label ?? $column_value_true . ' ' . $this->lng->txt('order_option_first'),
62 $this->desc_label ?? $column_value_false . ' ' . $this->lng->txt('order_option_first')
63 ];
64 }
65}
__construct(protected Language $lng, string $title, protected string|Icon|Glyph $true_option, protected string|Icon|Glyph $false_option)
Definition: Boolean.php:32
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:29
This describes a symbol.
Definition: Symbol.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31