Directory.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // {{{ License
  3. // This file is part of GNU social - https://www.gnu.org/software/social
  4. //
  5. // GNU social is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Affero General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // GNU social is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Affero General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  17. // }}}
  18. namespace Plugin\Directory;
  19. use App\Core\Event;
  20. use App\Core\Modules\Plugin;
  21. use App\Core\Router\RouteLoader;
  22. class Directory extends Plugin
  23. {
  24. /**
  25. * Map URLs to Controllers
  26. */
  27. public function onAddRoute(RouteLoader $r)
  28. {
  29. $r->connect('directory_actors', '/actors', [Controller\Directory::class, 'actors']);
  30. $r->connect('directory_groups', '/groups', [Controller\Directory::class, 'groups']);
  31. return Event::next;
  32. }
  33. /**
  34. * Populate twig vars
  35. *
  36. * @param array $vars
  37. *
  38. * @return bool hook value; true means continue processing, false means stop.
  39. */
  40. public function onStartTwigPopulateVars(array &$vars): bool
  41. {
  42. $vars['main_nav_tabs'][] = ['title' => 'Actors', 'route' => 'directory_actors'];
  43. $vars['main_nav_tabs'][] = ['title' => 'Groups', 'route' => 'directory_groups'];
  44. return Event::next;
  45. }
  46. }