File: /home/timetracker.panomity.com/tm.old/EventSubscriber/ActivitySubscriber.php
<?php
/*
* This file is part of the TaskManagementBundle for Kimai 2.
* All rights reserved by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace KimaiPlugin\TaskManagementBundle\EventSubscriber;
use App\Entity\Activity;
use App\Event\PageActionsEvent;
use App\EventSubscriber\Actions\AbstractActionsSubscriber;
class ActivitySubscriber extends AbstractActionsSubscriber
{
public static function getActionName(): string
{
return 'activity';
}
public function onActions(PageActionsEvent $event): void
{
$payload = $event->getPayload();
if (!isset($payload['activity'])) {
return;
}
/** @var Activity $activity */
$activity = $payload['activity'];
if ($activity->getId() === null) {
return;
}
$event->addAction('create.task', ['url' => $this->path('tasks_create_activity', ['id' => $activity->getId()]), 'icon' => 'fas fa-clipboard-list', 'class' => 'modal-ajax-form']);
}
}