PageMenu.php 836 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace ColdTrick\SiteAnnouncements;
  3. class PageMenu {
  4. /**
  5. * add a page menu item for site announcements
  6. *
  7. * @param string $hook the name of the hook
  8. * @param string $type the type of the hook
  9. * @param \ElggMenuItem[] $returnvalue current returnvalue
  10. * @param array $params supplied params
  11. *
  12. * @return \ElggMenuItem[]
  13. */
  14. public static function register($hook, $type, $returnvalue, $params) {
  15. if (!elgg_in_context('admin')) {
  16. return $returnvalue;
  17. }
  18. $returnvalue[] = \ElggMenuItem::factory(array(
  19. 'name' => 'site_announcements',
  20. 'text' => elgg_echo('site_annoucements'),
  21. 'href' => 'announcements/all',
  22. 'is_trusted' => true,
  23. 'section' => 'administer',
  24. 'parent_name' => 'administer_utilities'
  25. ));
  26. return $returnvalue;
  27. }
  28. }