Elgg  Version 3.0
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 = array_keys((array) elgg_get_config('profile_fields'));
33  array_walk($profile_fields, function(&$value) {
34  $value = "profile:{$value}";
35  });
36 
37  $value['annotations'] = array_merge($value['annotations'], $profile_fields);
38 
39  return $value;
40  }
41 }
$defaults
__invoke(Hook $hook)
Search through the user profile fields.
getValue()
Get the current value of the hook.
Models an event passed to hook handlers.
Definition: Hook.php:12
$value
Definition: debugging.php:7
elgg_get_config($name, $default=null)
Get an Elgg configuration value.