ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
trait.ilObjFileCopyrightInput.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
21 
23 
28 {
29  public function getCopyrightSelectionInput(string $lang_var_title): Radio
30  {
31  static $copyright_input;
32  // we chache the input field to avoid multiple creation in lists
33  if ($copyright_input !== null) {
34  return $copyright_input;
35  }
36 
37  $copyright_input = $this->getUIFactory()->input()->field()->radio($this->getLanguage()->txt($lang_var_title));
38  $copyright_options = ilMDCopyrightSelectionEntry::_getEntries();
39  $default_entry_id = ilMDCopyrightSelectionEntry::getDefault();
40  foreach ($copyright_options as $copyright_option) {
41  if ($copyright_option->getOutdated()) {
42  continue;
43  }
44  $entry_id = $copyright_option->getEntryId();
45  $copyright_input = $copyright_input->withOption(
46  (string) $entry_id,
47  $copyright_option->getTitle(),
48  $copyright_option->getDescription()
49  );
50  if ($entry_id === $default_entry_id) {
51  $copyright_input = $copyright_input->withValue($entry_id);
52  }
53  }
54 
55  return $copyright_input;
56  }
57 
58  abstract protected function getUIFactory(): Factory;
59 
60  abstract protected function getLanguage(): \ilLanguage;
61 }
This implements the radio input.
Definition: Radio.php:34
getLanguage()
language handling