Elgg  Version 4.3
UserSearchProfileFieldsHandler.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  'annotations' => [],
28  ];
29 
30  $value = array_merge($defaults, $value);
31 
32  $profile_fields = _elgg_services()->fields->get('user', 'user');
33  foreach ($profile_fields as $field) {
34  $value['annotations'][] = "profile:{$field['name']}";
35  }
36 
37  return $value;
38  }
39 }
$defaults
__invoke(Hook $hook)
Search through the user profile fields.
$value
Definition: generic.php:51
getValue()
Get the current value of the hook.
Models an event passed to hook handlers.
Definition: Hook.php:11
if(elgg_extract('required', $vars)) if(elgg_extract('disabled', $vars)) $field
Definition: field.php:37
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638