ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
trait.ilObjFileCopyrightInput.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
29 {
30  public function getCopyrightSelectionInput(string $lang_var_title): Radio
31  {
32  static $copyright_input;
33  // we chache the input field to avoid multiple creation in lists
34  if ($copyright_input !== null) {
35  return $copyright_input;
36  }
37 
38  $copyright_input = $this->getUIFactory()->input()->field()->radio($this->getLanguage()->txt($lang_var_title));
39  foreach ($this->lom_services->copyrightHelper()->getNonOutdatedCopyrightPresets() as $copyright_option) {
40  $copyright_input = $copyright_input->withOption(
41  $copyright_option->identifier(),
42  $copyright_option->title(),
43  $copyright_option->description()
44  );
45  if ($copyright_option->isDefault()) {
46  $copyright_input = $copyright_input->withValue($copyright_option->identifier());
47  }
48  }
49 
50  return $copyright_input;
51  }
52 
53  abstract protected function getUIFactory(): Factory;
54 
55  abstract protected function getLanguage(): \ilLanguage;
56 }
This implements the radio input.
Definition: Radio.php:34
getLanguage()
This is how the factory for UI elements looks.
Definition: Factory.php:37
language handling
withOption(string $value, string $label, string $byline=null)
Definition: Radio.php:74