ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ButtonFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\UI\Factory as UIFactory;
25use ILIAS\UI\Component\Button\Standard as StandardButton;
26use ILIAS\UI\Component\Button\Shy as ShyButton;
29
31{
32 protected UIFactory $factory;
34
35 public function __construct(
36 UIFactory $factory,
38 ) {
39 $this->factory = $factory;
40 $this->presenter = $presenter;
41 }
42
43 public function delete(
44 FlexibleSignal $signal,
45 bool $is_shy = false,
46 bool $long_text = false
47 ): Button {
48 $label = $this->presenter->utilities()->txt(
49 $long_text ? 'meta_delete_this_element' : 'delete'
50 );
51 if ($is_shy) {
52 return $this->getShyButton($label, $signal);
53 }
54 return $this->getStandardButton($label, $signal);
55 }
56
57 public function update(
58 FlexibleSignal $signal
59 ): ShyButton {
60 $label = $this->presenter->utilities()->txt('edit');
61 return $this->getShyButton($label, $signal);
62 }
63
64 public function create(
65 FlexibleSignal $signal,
66 ElementInterface $element,
67 bool $is_shy = false
68 ): Button {
69 $label = $this->presenter->utilities()->txtFill(
70 'meta_add_element',
71 $this->presenter->elements()->name($element)
72 );
73 if ($is_shy) {
74 return $this->getShyButton($label, $signal);
75 }
76 return $this->getStandardButton($label, $signal);
77 }
78
79 protected function getShyButton(
80 string $label,
81 FlexibleSignal $signal
82 ): ShyButton {
83 return $this->factory->button()->shy($label, $signal->get());
84 }
85
86 protected function getStandardButton(
87 string $label,
88 FlexibleSignal $signal
89 ): StandardButton {
90 return $this->factory->button()->standard($label, $signal->get());
91 }
92}
factory()
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
getStandardButton(string $label, FlexibleSignal $signal)
getShyButton(string $label, FlexibleSignal $signal)
__construct(UIFactory $factory, PresenterInterface $presenter)
create(FlexibleSignal $signal, ElementInterface $element, bool $is_shy=false)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes commonalities between standard and primary buttons.
Definition: Button.php:34
This describes a standard button.
Definition: Standard.php:27
get(string $class_name)
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21