ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ILIAS\User\Search\DefaultAutocompleteItem Class Reference
+ Inheritance diagram for ILIAS\User\Search\DefaultAutocompleteItem:
+ Collaboration diagram for ILIAS\User\Search\DefaultAutocompleteItem:

Public Member Functions

 __construct (private readonly string $login, private readonly string $lastname, private readonly string $firstname, private readonly string $unprocessed_search_term)
 
 getTagArray ()
 MUST return an array containing three properties "value", "display", and "searchBy". More...
 
 getTagArray ()
 MUST return an array containing three properties "value", "display", and "searchBy". More...
 

Private Member Functions

 buildNameComponent ()
 

Detailed Description

Definition at line 23 of file DefaultAutocompleteItem.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Search\DefaultAutocompleteItem::__construct ( private readonly string  $login,
private readonly string  $lastname,
private readonly string  $firstname,
private readonly string  $unprocessed_search_term 
)

Definition at line 25 of file DefaultAutocompleteItem.php.

30 {
31 }

Member Function Documentation

◆ buildNameComponent()

ILIAS\User\Search\DefaultAutocompleteItem::buildNameComponent ( )
private

Definition at line 51 of file DefaultAutocompleteItem.php.

51 : string
52 {
53 if ($this->lastname !== '') {
54 return "{$this->lastname}, {$this->firstname}";
55 }
56
57 return $this->firstname;
58 }

◆ getTagArray()

ILIAS\User\Search\DefaultAutocompleteItem::getTagArray ( )

MUST return an array containing three properties "value", "display", and "searchBy".

The property "value" MUST be save to transmit as url-parameter. The returned tags will then again be filtered by the value in the property "searchBy". If you need to show the tag even if you are not allowed to divulge the full value of the field the search string was found in, you can simply reuse the search term here. See the `\ILIAS\User\Search\DefaultAutocompleteItem for an implementation of this.

Implements ILIAS\User\Search\AutocompleteItem.

Definition at line 33 of file DefaultAutocompleteItem.php.

33 : array
34 {
35 $return = [
36 'value' => rawurlencode($this->login),
37 'searchBy' => $this->unprocessed_search_term
38 ];
39
40 if ($this->lastname === '' && $this->firstname === '') {
41 return $return + [
42 'display' => $this->login
43 ];
44 }
45
46 return $return + [
47 'display' => "{$this->login} [{$this->buildNameComponent()}]"
48 ];
49 }

References ILIAS\UI\examples\Symbol\Glyph\Login\login().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: