getEventData(); $type = $data['type']; $courseInfo = $data['course_info']; $plugin = TopLinksPlugin::create(); $em = Database::getManager(); $linkRepo = $em->getRepository(TopLink::class); if (HOOK_EVENT_TYPE_POST == $type) { foreach ($linkRepo->findAll() as $link) { $plugin->addToolInCourse($courseInfo['real_id'], $link); } } return (int) $courseInfo['real_id']; } }