ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
HeaderActionVisibility.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
32 {
33  private const DEFAULT_HEADER_ACTION_VISIBILITY = true;
34 
35  private const INPUT_LABEL = 'obj_show_header_actions';
36 
37  public function __construct(
38  private bool $header_action_visibility = self::DEFAULT_HEADER_ACTION_VISIBILITY
39  ) {
40  }
41 
42  public function getVisibility(): bool
43  {
44  return $this->header_action_visibility;
45  }
46 
47  public function toForm(
48  \ilLanguage $language,
49  FieldFactory $field_factory,
51  ): Checkbox {
52  $trafo = $refinery->custom()->transformation(
53  function ($v): Property {
54  return new HeaderActionVisibility($v);
55  }
56  );
57  return $field_factory->checkbox($language->txt(self::INPUT_LABEL))
59  ->withValue($this->getVisibility());
60  }
61 
62 
63  public function toLegacyForm(
64  \ilLanguage $language
65  ): \ilCheckboxInputGUI {
66  $top_actions_visibility_input = new \ilCheckboxInputGUI(
67  $language->txt(self::INPUT_LABEL),
68  'show_top_actions'
69  );
70  $top_actions_visibility_input->setValue('1');
71  $top_actions_visibility_input->setChecked($this->getVisibility());
72 
73  return $top_actions_visibility_input;
74  }
75 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This describes checkbox inputs.
Definition: Checkbox.php:28
toForm(\ilLanguage $language, FieldFactory $field_factory, Refinery $refinery)
__construct(private bool $header_action_visibility=self::DEFAULT_HEADER_ACTION_VISIBILITY)