19declare(strict_types=1);
41function with_autocomplete_endpoint()
45 $ui =
$DIC->ui()->factory();
50 $df = new \ILIAS\Data\Factory();
52 [$url_builder, $term_token] = (
new URLBuilder($df->uri(
$http->request()->getUri()->__toString())))
53 ->acquireParameter([
'examples'],
'term');
55 $search_term =
$http->wrapper()->query()->retrieve(
56 $term_token->getName(),
63 if ($search_term !==
'') {
66 [
'Interesting',
'Boring',
'Animating',
'Repetitious'],
67 static function (array
$c,
string $v) use (
$refinery, $search_term): array {
68 if (stristr($v, $search_term)) {
70 'value' => urlencode(
$refinery->encode()->htmlSpecialCharsAsEntities()->transform($v)),
81 $http->response()->withBody(
85 $http->sendResponse();
89 $tag_input = $ui->input()->field()->tag(
90 "Tag Input with Autocomplete",
92 )->withAsyncAutocomplete(
95 )->withUserCreatedTagsAllowed(
false);
98 $ui->input()->container()->form()->standard(
"#", [$tag_input])
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.