19 declare(strict_types=1);
99 case ($component instanceof
F\
Section):
105 case ($component instanceof
F\
Link):
108 case ($component instanceof
F\
Group):
109 return $default_renderer->render($component->getInputs());
111 case ($component instanceof
F\
Text):
114 case ($component instanceof
F\
Numeric):
120 case ($component instanceof
F\
Tag):
126 case ($component instanceof
F\
Select):
130 return $this->renderMarkdownField($component, $default_renderer);
133 return $this->renderTextareaField($component, $default_renderer);
135 case ($component instanceof
F\
Radio):
144 case ($component instanceof
F\
Image):
147 case ($component instanceof
F\
File):
150 case ($component instanceof
F\
Url):
153 case ($component instanceof
F\
Hidden):
159 case ($component instanceof
F\
Rating):
177 ?
string $id_for_label =
null,
178 ?
string $dependant_group_html =
null 180 $tpl = $this->
getTemplate(
"tpl.context_form.html",
true,
true);
182 $tpl->setVariable(
"LABEL", $label);
183 $tpl->setVariable(
"INPUT", $input_html);
185 $tpl->setVariable(
"INPUT_NAME", $component->getName());
189 $tpl->setVariable(
"BINDING_ID", $binding_id);
193 $tpl->setCurrentBlock(
'for');
194 $tpl->setVariable(
"ID", $id_for_label);
195 $tpl->parseCurrentBlock();
197 $tpl->touchBlock(
'tabindex');
202 $tpl->setVariable(
"BYLINE", $byline);
207 $tpl->setCurrentBlock(
'required');
208 $tpl->setVariable(
"REQUIRED_ARIA", $this->
txt(
'required_field'));
209 $tpl->parseCurrentBlock();
213 $tpl->touchBlock(
"disabled");
216 $error = $component->getError();
219 $tpl->setVariable(
"ERROR_LABEL", $this->
txt(
"ui_error"));
220 $tpl->setVariable(
"ERROR_ID", $error_id);
221 $tpl->setVariable(
"ERROR",
$error);
223 $tpl->setVariable(
"ERROR_FOR_ID", $id_for_label);
227 if ($dependant_group_html) {
228 $tpl->setVariable(
"DEPENDANT_GROUP", $dependant_group_html);
235 $name = $component->getName();
258 if (!is_null($escape)) {
259 $value = $escape($value);
261 if (isset($value) && $value !==
'') {
268 return function ($v) {
272 return htmlspecialchars((
string) $v, ENT_QUOTES,
'utf-8',
false);
278 return function ($v) {
282 return htmlentities((
string) $v, ENT_QUOTES,
'utf-8',
false);
288 $input_html = $default_renderer->render($component->getInputs());
291 $component->getLabel(),
298 $tpl = $this->
getTemplate(
"tpl.text.html",
true,
true);
301 if ($component->getMaxLength()) {
302 $tpl->setVariable(
"MAX_LENGTH", $component->getMaxLength());
308 $tpl->setVariable(
'ID', $label_id);
309 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
314 $tpl = $this->
getTemplate(
"tpl.numeric.html",
true,
true);
318 $tpl->setVariable(
"STEPSIZE", $component->getStepSize());
321 $tpl->setVariable(
'ID', $label_id);
322 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
327 $tpl = $this->
getTemplate(
"tpl.checkbox.html",
true,
true);
330 if ($component->getValue()) {
331 $tpl->touchBlock(
"value");
335 $tpl->setVariable(
'ID', $label_id);
336 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
341 $tpl = $this->
getTemplate(
"tpl.optionalgroup_label.html",
true,
true);
342 $tpl->setVariable(
'LABEL', $component->getLabel());
343 $tpl->setVariable(
"NAME", $component->getName());
344 if ($component->getValue()) {
345 $tpl->setVariable(
"CHECKED",
'checked="checked"');
349 $tpl->setVariable(
'ID', $label_id);
351 $label = $tpl->get();
352 $input_html = $default_renderer->render($component->getInputs());
360 if ($component->getValue() !==
null) {
361 list($value, ) = $component->getValue();
365 foreach ($component->getInputs() as $key => $group) {
366 $tpl = $this->
getTemplate(
"tpl.switchablegroup_label.html",
true,
true);
367 $tpl->setVariable(
'LABEL', $group->getLabel());
368 $tpl->setVariable(
"NAME", $component->getName());
369 $tpl->setVariable(
"VALUE", $key);
372 $tpl->setVariable(
'ID', $label_id);
374 if ($key == $value) {
375 $tpl->setVariable(
"CHECKED",
'checked="checked"');
381 $default_renderer->render($group),
389 $component->getLabel(),
396 $tpl = $this->
getTemplate(
"tpl.tag_input.html",
true,
true);
399 $configuration = $component->getConfiguration();
400 $value = $component->getValue();
405 return [
'value' => urlencode($v),
'display' => $v];
411 $component = $component->withAdditionalOnLoadCode(
412 function (
$id) use ($configuration, $value) {
413 $encoded = json_encode($configuration);
414 $value = json_encode($value);
415 return "il.UI.Input.tagInput.init('{$id}', {$encoded}, {$value});";
419 if ($component->isDisabled()) {
420 $tpl->setVariable(
"DISABLED",
"disabled");
421 $tpl->setVariable(
"READONLY",
"readonly");
425 $tpl->setVariable(
'ID', $label_id);
426 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
431 $tpl = $this->
getTemplate(
"tpl.password.html",
true,
true);
434 if ($component->getRevelation()) {
435 $component = $component->withResetSignals();
436 $sig_reveal = $component->getRevealSignal();
437 $sig_mask = $component->getMaskSignal();
438 $component = $component->withAdditionalOnLoadCode(
function (
$id) use ($sig_reveal, $sig_mask) {
440 "$(document).on('$sig_reveal', function() { 441 const fieldContainer = document.querySelector('#$id .c-input__field .c-field-password'); 442 fieldContainer.classList.add('revealed'); 443 fieldContainer.getElementsByTagName('input').item(0).type='text'; 445 "$(document).on('$sig_mask', function() { 446 const fieldContainer = document.querySelector('#$id .c-input__field .c-field-password'); 447 fieldContainer.classList.remove('revealed'); 448 fieldContainer.getElementsByTagName('input').item(0).type='password'; 453 $glyph_reveal =
$f->symbol()->glyph()->eyeopen(
"#")
454 ->withOnClick($sig_reveal);
455 $glyph_mask =
$f->symbol()->glyph()->eyeclosed(
"#")
456 ->withOnClick($sig_mask);
458 $tpl->setVariable(
'PASSWORD_REVEAL', $default_renderer->render($glyph_reveal));
459 $tpl->setVariable(
'PASSWORD_MASK', $default_renderer->render($glyph_mask));
465 $tpl->setVariable(
'ID', $label_id);
466 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
471 $tpl = $this->
getTemplate(
"tpl.select.html",
true,
true);
474 $value = $component->getValue();
476 $tpl->setCurrentBlock(
"options");
478 $tpl->setVariable(
"SELECTED",
'selected="selected"');
480 if ($component->isRequired() && !$value) {
481 $tpl->setVariable(
"DISABLED_OPTION",
"disabled");
482 $tpl->setVariable(
"HIDDEN",
"hidden");
485 if (!($value && $component->isRequired())) {
486 $tpl->setVariable(
"VALUE",
null);
487 $tpl->setVariable(
"VALUE_STR", $component->isRequired() ? $this->
txt(
'ui_select_dropdown_label') :
'-');
488 $tpl->parseCurrentBlock();
491 foreach ($component->getOptions() as $option_key => $option_value) {
492 $tpl->setCurrentBlock(
"options");
493 if ($value == $option_key) {
494 $tpl->setVariable(
"SELECTED",
'selected="selected"');
496 $tpl->setVariable(
"VALUE", $option_key);
497 $tpl->setVariable(
"VALUE_STR", $option_value);
498 $tpl->parseCurrentBlock();
502 $tpl->setVariable(
'ID', $label_id);
503 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
509 $component = $component->withAdditionalOnLoadCode(
510 static function (
$id) use ($component):
string {
512 const id = document.querySelector('#$id .c-input__field textarea')?.id; 513 il.UI.Input.markdown.init( 515 '{$component->getMarkdownRenderer()->getAsyncUrl()}', 516 '{$component->getMarkdownRenderer()->getParameterName()}' 524 $textarea_tpl->setVariable(
'ID', $textarea_id);
526 $markdown_tpl = $this->
getTemplate(
"tpl.markdown.html",
true,
true);
527 $markdown_tpl->setVariable(
'TEXTAREA', $textarea_tpl->get());
529 $markdown_tpl->setVariable(
531 $component->getMarkdownRenderer()->render(
536 $markdown_tpl->setVariable(
538 $default_renderer->render(
539 $this->getUIFactory()->viewControl()->mode([
540 $this->
txt(
'ui_md_input_edit') =>
'#',
541 $this->
txt(
'ui_md_input_view') =>
'#',
547 $markdown_actions_glyphs = [
548 'ACTION_HEADING' => $this->
getUIFactory()->symbol()->glyph()->header(),
549 'ACTION_LINK' => $this->
getUIFactory()->symbol()->glyph()->link(),
550 'ACTION_BOLD' => $this->
getUIFactory()->symbol()->glyph()->bold(),
551 'ACTION_ITALIC' => $this->
getUIFactory()->symbol()->glyph()->italic(),
552 'ACTION_ORDERED_LIST' => $this->
getUIFactory()->symbol()->glyph()->numberedlist(),
553 'ACTION_UNORDERED_LIST' => $this->
getUIFactory()->symbol()->glyph()->bulletlist()
556 foreach ($markdown_actions_glyphs as $tpl_variable => $glyph) {
557 if ($component->isDisabled()) {
558 $glyph = $glyph->withUnavailableAction();
561 $action = $this->
getUIFactory()->button()->standard(
'',
'#')->withSymbol($glyph);
563 if ($component->isDisabled()) {
564 $action = $action->withUnavailableAction();
567 $markdown_tpl->setVariable($tpl_variable, $default_renderer->render($action));
570 return $this->
wrapInFormContext($component, $component->getLabel(), $markdown_tpl->get());
576 $component = $component->withAdditionalOnLoadCode(
577 static function (
$id):
string {
579 taId = document.querySelector('#$id .c-input__field textarea')?.id; 580 il.UI.Input.textarea.init(taId); 588 $tpl->setVariable(
'ID', $label_id);
589 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
594 $tpl = $this->
getTemplate(
"tpl.textarea.html",
true,
true);
596 if (0 < $component->getMaxLimit()) {
597 $tpl->setVariable(
'REMAINDER_TEXT', $this->
txt(
'ui_chars_remaining'));
598 $tpl->setVariable(
'REMAINDER', $component->getMaxLimit() - strlen($component->getValue() ??
''));
599 $tpl->setVariable(
'MAX_LIMIT', $component->getMaxLimit());
602 if (
null !== $component->getMinLimit()) {
603 $tpl->setVariable(
'MIN_LIMIT', $component->getMinLimit());
613 $tpl = $this->
getTemplate(
"tpl.radio.html",
true,
true);
616 foreach ($component->getOptions() as $value => $label) {
617 $opt_id =
$id .
'_' . $value .
'_opt';
619 $tpl->setCurrentBlock(
'optionblock');
620 $tpl->setVariable(
"NAME", $component->getName());
621 $tpl->setVariable(
"OPTIONID", $opt_id);
622 $tpl->setVariable(
"VALUE", $value);
623 $tpl->setVariable(
"LABEL", $label);
625 if ($component->getValue() !==
null && $component->getValue() == $value) {
626 $tpl->setVariable(
"CHECKED",
'checked="checked"');
628 if ($component->isDisabled()) {
629 $tpl->setVariable(
"DISABLED",
'disabled="disabled"');
632 $byline = $component->getBylineFor((
string) $value);
633 if (!empty($byline)) {
634 $tpl->setVariable(
"BYLINE", $byline);
637 $tpl->parseCurrentBlock();
640 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get());
645 $tpl = $this->
getTemplate(
"tpl.multiselect.html",
true,
true);
647 $options = $component->getOptions();
648 if (count($options) > 0) {
649 $value = $component->getValue();
650 $name = $this->
applyName($component, $tpl);
651 foreach ($options as $opt_value => $opt_label) {
652 $tpl->setCurrentBlock(
"option");
653 $tpl->setVariable(
"NAME", $name);
654 $tpl->setVariable(
"VALUE", $opt_value);
655 $tpl->setVariable(
"LABEL", $opt_label);
657 if ($value && in_array($opt_value, $value)) {
658 $tpl->setVariable(
"CHECKED",
'checked="checked"');
660 $tpl->parseCurrentBlock();
663 $tpl->touchBlock(
"no_options");
666 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get());
673 $tpl->setVariable(
'ID', $label_id);
674 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
682 $tpl = $this->
getTemplate(
"tpl.datetime.html",
true,
true);
685 if ($component->getTimeOnly() ===
true) {
686 $format = $component::TIME_FORMAT;
687 $dt_type = self::TYPE_TIME;
689 $dt_type = self::TYPE_DATE;
691 $component->getFormat(),
692 self::DATEPICKER_FORMAT_MAPPING
695 if ($component->getUseTime() ===
true) {
696 $format .=
' ' . $component::TIME_FORMAT;
697 $dt_type = self::TYPE_DATETIME;
701 $tpl->setVariable(
"DTTYPE", $dt_type);
703 $min_max_format = self::DATE_DATEPICKER_MINMAX_FORMAT;
704 if ($dt_type === self::TYPE_DATETIME) {
705 $min_max_format = self::DATETIME_DATEPICKER_MINMAX_FORMAT;
708 $min_date = $component->getMinValue();
709 if (!is_null($min_date)) {
710 $tpl->setVariable(
"MIN_DATE", date_format($min_date, $min_max_format));
712 $max_date = $component->getMaxValue();
713 if (!is_null($max_date)) {
714 $tpl->setVariable(
"MAX_DATE", date_format($max_date, $min_max_format));
717 $this->
applyValue($component, $tpl,
function (?
string $value) use ($dt_type) {
718 if ($value !==
null) {
719 $value = new \DateTimeImmutable($value);
720 return $value->format(match ($dt_type) {
721 self::TYPE_DATETIME => self::HTML5_NATIVE_DATETIME_FORMAT,
722 self::TYPE_DATE => self::HTML5_NATIVE_DATE_FORMAT,
723 self::TYPE_TIME => self::HTML5_NATIVE_TIME_FORMAT,
728 return [$component, $tpl];
733 $inputs = $component->getInputs();
739 $tpl->setVariable(
'ID', $from_input_id);
740 $input_html = $this->
wrapInFormContext($input, $input->getLabel(), $tpl->get(), $from_input_id);
743 ->withAdditionalPickerconfig([
'useCurrent' =>
false]);
745 $until_input_id = $this->
createId();
746 $tpl->setVariable(
'ID', $until_input_id);
747 $input_html .= $this->
wrapInFormContext($input, $input->getLabel(), $tpl->get(), $until_input_id);
749 $tpl = $this->
getTemplate(
"tpl.duration.html",
true,
true);
750 $tpl->setVariable(
'DURATION', $input_html);
751 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get());
756 $inputs_html = $default_renderer->render($section->getInputs());
758 $headline_tpl = $this->
getTemplate(
"tpl.headlines.html",
true,
true);
759 $headline_tpl->setVariable(
"HEADLINE", $section->getLabel());
760 $nesting_level = $section->getNestingLevel() + 2;
761 if ($nesting_level > 6) {
764 $headline_tpl->setVariable(
"LEVEL", $nesting_level);
766 $headline_html = $headline_tpl->get();
773 $tpl = $this->
getTemplate(
"tpl.url.html",
true,
true);
778 $tpl->setVariable(
'ID', $label_id);
779 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
789 $template = $this->
getTemplate(
'tpl.file.html',
true,
true);
790 foreach ($input->getGeneratedDynamicInputs() as $metadata_input) {
792 if (
null !== (
$data = $metadata_input->getValue())) {
793 $file_id = (!$input->hasMetadataInputs()) ?
$data :
$data[0] ??
null;
795 if (
null !== $file_id) {
796 $file_info = $input->getUploadHandler()->getInfoResult($file_id);
809 $file_preview_template = $this->
getTemplate(
'tpl.file.html',
true,
true);
812 $input->getTemplateForDynamicInputs(),
815 $file_preview_template
818 $template->setVariable(
'FILE_PREVIEW_TEMPLATE', $file_preview_template->get(
'block_file_preview'));
825 $template->setVariable(
'ACTION_BUTTON', $default_renderer->render(
826 $this->getUIFactory()->button()->shy(
827 $this->
txt(
'select_files_from_computer'),
841 $template = $this->
getTemplate(
'tpl.hidden.html',
true,
true);
844 if ($input->isDisabled()) {
845 $template->setVariable(
"DISABLED",
'disabled="disabled"');
848 return $template->get();
856 parent::registerResources($registry);
857 $registry->
register(
'assets/js/tagify.js');
858 $registry->
register(
'assets/css/tagify.css');
859 $registry->
register(
'assets/js/tagInput.js');
861 $registry->
register(
'assets/js/dropzone.min.js');
862 $registry->
register(
'assets/js/dropzone.js');
863 $registry->
register(
'assets/js/input.js');
864 $registry->
register(
'assets/js/core.js');
865 $registry->
register(
'assets/js/file.js');
867 $registry->
register(
'assets/js/drilldown.min.js');
868 $registry->
register(
'assets/js/input.factory.min.js');
878 foreach ($input->getTriggeredSignals() as $s) {
880 "signal_id" => $s->getSignal()->getId(),
881 "event" => $s->getEvent(),
882 "options" => $s->getSignal()->getOptions()
885 if ($signals !==
null) {
886 $signals = json_encode($signals);
888 $input = $input->withAdditionalOnLoadCode(
function (
$id) use ($signals) {
889 $code =
"il.UI.input.setSignalsForId('$id', $signals);";
893 $input = $input->withAdditionalOnLoadCode($input->getUpdateOnLoadCode());
909 foreach ($origin->toArray() as $element) {
910 if (array_key_exists($element, $mapping)) {
911 $ret .= $mapping[$element];
927 $template->
setVariable(
'REMOVAL_GLYPH', $default_renderer->render(
928 $this->getUIFactory()->symbol()->glyph()->close()->withAction(
"#")
931 if (
null !== $file_info) {
941 if ($file_input->hasMetadataInputs()) {
942 $template->
setVariable(
'EXPAND_GLYPH', $default_renderer->render(
943 $this->getUIFactory()->symbol()->glyph()->expand()->withAction(
"#")
945 $template->
setVariable(
'COLLAPSE_GLYPH', $default_renderer->render(
946 $this->getUIFactory()->symbol()->glyph()->collapse()->withAction(
"#")
950 $template->
setVariable(
'METADATA_INPUTS', $default_renderer->render($metadata_input));
959 return $input->withAdditionalOnLoadCode(
960 function (
$id) use ($input) {
961 $current_file_count = count($input->getGeneratedDynamicInputs());
962 $translations = json_encode($input->getTranslations());
963 $is_disabled = ($input->isDisabled()) ?
'true' :
'false';
965 $should_upload_be_chunked = ($input->getMaxFileSize() > $php_upload_limit) ?
'true' :
'false';
966 $chunk_size = (
int) floor($php_upload_limit * self::FILE_UPLOAD_CHUNK_SIZE_FACTOR);
968 $(document).ready(function () { 969 il.UI.Input.File.init( 971 '{$input->getUploadHandler()->getUploadURL()}', 972 '{$input->getUploadHandler()->getFileRemovalURL()}', 973 '{$input->getUploadHandler()->getFileIdentifierParameterName()}', 975 {$input->getMaxFiles()}, 976 {$input->getMaxFileSize()}, 977 '{$this->prepareDropzoneJsMimeTypes($input->getAcceptedMimeTypes())}', 980 $should_upload_be_chunked, 996 $mime_type_string =
'';
997 foreach ($mime_types as $index => $mime_type) {
998 $mime_type_string .= (isset($mime_types[$index + 1])) ?
"$mime_type," : $mime_type;
1001 return $mime_type_string;
1006 $tpl = $this->
getTemplate(
"tpl.color_select.html",
true,
true);
1008 $tpl->setVariable(
'VALUE', $component->getValue());
1011 $tpl->setVariable(
'ID', $label_id);
1012 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get(), $label_id);
1017 $tpl = $this->
getTemplate(
"tpl.rating.html",
true,
true);
1019 $aria_description_id =
$id .
'_desc';
1020 $tpl->setVariable(
'DESCRIPTION_SRC_ID', $aria_description_id);
1022 $option_count = count(FiveStarRatingScale::cases()) - 1;
1024 foreach (range($option_count, 1, -1) as $option) {
1025 $tpl->setCurrentBlock(
'scaleoption');
1026 $tpl->setVariable(
'ARIALABEL', $this->
txt($option .
'stars'));
1027 $tpl->setVariable(
'OPT_VALUE', (
string) $option);
1028 $tpl->setVariable(
'OPT_ID',
$id .
'-' . $option);
1029 $tpl->setVariable(
'NAME', $component->getName());
1030 $tpl->setVariable(
'DESCRIPTION_ID', $aria_description_id);
1033 $tpl->setVariable(
"SELECTED",
' checked="checked"');
1035 if ($component->isDisabled()) {
1036 $tpl->setVariable(
"DISABLED",
'disabled="disabled"');
1038 $tpl->parseCurrentBlock();
1041 if (!$component->isRequired()) {
1042 $tpl->setVariable(
'NEUTRAL_ID',
$id .
'-0');
1043 $tpl->setVariable(
'NEUTRAL_NAME', $component->getName());
1044 $tpl->setVariable(
'NEUTRAL_LABEL', $this->
txt(
'reset_stars'));
1045 $tpl->setVariable(
'NEUTRAL_DESCRIPTION_ID', $aria_description_id);
1047 if ($component->getValue() === FiveStarRatingScale::NONE || is_null($component->getValue())) {
1048 $tpl->setVariable(
'NEUTRAL_SELECTED',
' checked="checked"');
1052 if (
$txt = $component->getAdditionalText()) {
1053 $tpl->setVariable(
'TEXT',
$txt);
1056 if ($component->isDisabled()) {
1057 $tpl->touchBlock(
'disabled');
1059 if ($average = $component->getCurrentAverage()) {
1060 $average_title = sprintf($this->
txt(
'rating_average'), $average);
1061 $tpl->setVariable(
'AVERAGE_VALUE', $average_title);
1062 $tpl->setVariable(
'AVERAGE_VALUE_PERCENT', $average / $option_count * self::CENTUM);
1065 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get());
1070 $template = $this->prepareTreeSelectTemplate($component, $default_renderer);
1072 if ($component->canSelectChildNodes()) {
1073 $select_child_nodes =
'true';
1075 $select_child_nodes =
'false';
1078 $enriched_component = $component->withAdditionalOnLoadCode(
1079 static fn(
$id) =>
"il.UI.Input.treeSelect.initTreeMultiSelect('$id', $select_child_nodes);" 1089 $template = $this->prepareTreeSelectTemplate($component, $default_renderer);
1091 $enriched_component = $component->withAdditionalOnLoadCode(
1092 static fn(
$id) =>
"il.UI.Input.treeSelect.initTreeSelect('$id');" 1100 protected function prepareTreeSelectTemplate(
1104 $template = $this->
getTemplate(
'tpl.tree_select.html',
true,
true);
1107 $template->setVariable(
'DISABLED',
'disabled');
1110 $template->setVariable(
'SELECT_LABEL', $this->
txt(
'select'));
1111 $template->setVariable(
'CLOSE_LABEL', $this->
txt(
'close'));
1112 $template->setVariable(
'LABEL', $component->
getLabel());
1114 $template->setVariable(
'INPUT_TEMPLATE', $default_renderer->render(
1117 $template->setVariable(
'BREADCRUMB_TEMPLATE', $default_renderer->render(
1120 $template->setVariable(
'BREADCRUMBS', $default_renderer->render(
1121 $this->getUIFactory()->breadcrumbs([])
1124 $node_factory = $this->
getUIFactory()->input()->field()->node();
1131 foreach ($node_generator as $node) {
1133 $this->checkArgInstanceOf(
'node', $node,
Component\
Input\Field\Node\Node::class);
1137 $template->setVariable(
'DRILLDOWN', $default_renderer->render(
1138 $this->getUIFactory()->menu()->drilldown($component->
getLabel(), $nodes)
1152 foreach ($lockstep_iterator as [$leaf, $dynamic_input]) {
1155 $this->checkArgInstanceOf(
'leaf', $leaf, Node\Leaf::class);
1157 $value_template = $this->
getTemplate(
'tpl.tree_select.html',
true,
true);
1158 $value_template->setCurrentBlock(
'with_value_template');
1159 $value_template->setVariable(
'NODE_ID', (
string) ($leaf->getId()));
1160 $value_template->setVariable(
'NODE_NAME', $leaf->getName());
1161 $value_template->setVariable(
'INPUT_TEMPLATE', $default_renderer->render($dynamic_input));
1162 $value_template->setVariable(
'UNSELECT_NODE_LABEL', sprintf($this->
txt(
'unselect_node'), $leaf->getName()));
1163 $value_template->parseCurrentBlock();
1165 $template->setCurrentBlock(
'with_value');
1166 $template->setVariable(
'VALUE', $value_template->get(
'with_value_template'));
1167 $template->parseCurrentBlock();
1170 $this->
toJS(
'unselect_node');
1171 $this->
toJS(
'select_node');
1185 while ($a->valid() && $b->valid()) {
1186 yield [$a->current(), $b->current()];
1190 if ($a->valid() || $b->valid()) {
1191 throw new LogicException(
'Generators do not have equal lenghts.');
1200 $template->
setVariable(
'FILE_SIZE_LABEL', $this->
txt(
'file_notice'));
1205 $template->
setVariable(
'FILES_LABEL', $this->
txt(
'ui_file_upload_max_nr'));
1206 $template->
setVariable(
'FILES_VALUE', $input->getMaxFiles());
Registry for resources required by rendered output like Javascript or CSS.
FiveStarRatingScale
This is the scale for the Rating Input.
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
This implements the textarea input.
This class provides the data size with additional information to remove the work to calculate the siz...
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
txt(string $id)
Get a text from the language file.
A password is used as part of credentials for authentication.
toJS($key)
Add language var to client side (il.Language)
This implements the text input.
setCurrentBlock(string $name)
Set the block to work on.
createId()
Get a fresh unique id.
setVariable(string $name, $value)
Set a variable in the current block.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
getOnLoadCode()
Get the currently bound on load code.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
Interface FileInfoResult.
register(string $name)
Add a dependency.
parseCurrentBlock()
Parse the block that is currently worked on.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
link(string $caption, string $href, bool $new_viewport=false)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getUIFactory()
Get a UI factory.
getComponentCanonicalNameAttribute(Component $component)
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.