Elgg  Version master
EntityUrlHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Widgets;
4 
11 
19  public function __invoke(\Elgg\Event $event): ?string {
20  $widget = $event->getEntityParam();
21  if (!$widget instanceof \ElggWidget) {
22  return null;
23  }
24 
25  $admin_segments = null;
26  switch ($widget->handler) {
27  case 'content_stats':
28  $admin_segments = 'statistics';
29  break;
30  case 'cron_status':
31  $admin_segments = 'cron';
32  break;
33  case 'banned_users':
34  $admin_segments = 'users/banned';
35  break;
36  case 'new_users':
37  $admin_segments = 'users';
38  break;
39  case 'online_users':
40  $admin_segments = 'users/online';
41  break;
42  case 'elgg_blog':
43  return 'https://elgg.org/blog/all';
44  }
45 
46  return $admin_segments ? elgg_generate_url('admin', ['segments' => $admin_segments]) : null;
47  }
48 }
__invoke(\Elgg\Event $event)
Returns widget URLS used in widget titles.
if($guid===false) $widget
Definition: add.php:31
elgg_generate_url(string $name, array $parameters=[])
Generate a URL for named route.
Models an event passed to event handlers.
Definition: Event.php:11