isAdmin()) { // user is already admin return $returnvalue; } $is_editor = site_announcements_is_editor($entity); $returnvalue[] = \ElggMenuItem::factory(array( 'name' => 'announcement_make_editor', 'text' => elgg_echo('site_announcements:user_hover:make_editor'), 'href' => "action/site_announcements/toggle_editor?user_guid={$entity->getGUID()}", 'item_class' => $is_editor ? 'hidden' : '', 'section' => 'admin', 'priority' => 400 )); $returnvalue[] = \ElggMenuItem::factory(array( 'name' => 'announcement_remove_editor', 'text' => elgg_echo('site_announcements:user_hover:remove_editor'), 'href' => "action/site_announcements/toggle_editor?user_guid={$entity->getGUID()}", 'item_class' => $is_editor ? '' : 'hidden', 'section' => 'admin', 'priority' => 401 )); return $returnvalue; } }