Elgg  Version 3.0
UserSearchFieldsHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Search;
4 
5 use Elgg\Hook;
6 
12 
22  public function __invoke(Hook $hook) {
23 
24  $value = (array) $hook->getValue();
25 
26  $defaults = [
27  'metadata' => [],
28  ];
29 
30  $value = array_merge($defaults, $value);
31 
32  $fields = [
33  'username',
34  'name',
35  'description',
36  ];
37 
38  $value['metadata'] = array_merge($value['metadata'], $fields);
39 
40  return $value;
41  }
42 }
$defaults
__invoke(Hook $hook)
Populate default search fields for user entities.
getValue()
Get the current value of the hook.
Models an event passed to hook handlers.
Definition: Hook.php:12
$fields
Definition: save.php:28
$value
Definition: debugging.php:7