Elgg
Version 2.3
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
views
default
input
autocomplete.php
Go to the documentation of this file.
1
<?php
16
if
(isset(
$vars
[
'class'
])) {
17
$vars
[
'class'
] =
"elgg-input-autocomplete {$vars['class']}"
;
18
}
else
{
19
$vars
[
'class'
] =
"elgg-input-autocomplete"
;
20
}
21
22
$defaults
= array(
23
'value'
=>
''
,
24
'disabled'
=>
false
,
25
);
26
27
$vars
= array_merge(
$defaults
,
$vars
);
28
29
$params
= array();
30
if
(isset(
$vars
[
'match_on'
])) {
31
$params
[
'match_on'
] =
$vars
[
'match_on'
];
32
unset(
$vars
[
'match_on'
]);
33
}
34
if
(isset(
$vars
[
'match_owner'
])) {
35
$params
[
'match_owner'
] =
$vars
[
'match_owner'
];
36
unset(
$vars
[
'match_owner'
]);
37
}
38
$vars
[
'type'
] =
'text'
;
39
$vars
[
'data-source'
] =
elgg_get_site_url
() .
'livesearch?'
. http_build_query(
$params
);
40
41
echo
elgg_format_element
(
'input'
,
$vars
);
42
43
// inline script in case loaded via ajax
44
?>
45
<script>
46
require
([
'elgg/autocomplete'
],
function
(autoc) {
47
autoc.init();
48
});
49
</script>
$defaults
$defaults
Definition:
autocomplete.php:22
elgg_format_element
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition:
output.php:208
$vars
$vars
Definition:
autocomplete.php:27
echo
elgg echo
Translates a string.
Definition:
languages.js:48
require
elgg require
Throw an error if the required package isn't present.
Definition:
elgglib.js:164
elgg_get_site_url
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
Definition:
configuration.php:27
$params
$params
Definition:
autocomplete.php:29
Generated on Sat Dec 21 2024 00:01:05 for Elgg by
1.8.11