User profile layout (#2402)

This commit is contained in:
Kevin Papst
2021-03-06 12:34:34 +01:00
committed by GitHub
parent d3099aca39
commit 5583caa9e4
30 changed files with 550 additions and 268 deletions

View File

@@ -10,6 +10,7 @@
namespace App\Twig\Runtime;
use App\Entity\User;
use App\Event\PageActionsEvent;
use App\Event\ThemeEvent;
use App\Event\ThemeJavascriptTranslationsEvent;
use Symfony\Bridge\Twig\AppVariable;
@@ -51,6 +52,23 @@ final class ThemeExtension implements RuntimeExtensionInterface
return $themeEvent;
}
public function actions(User $user, string $action, array $payload): ThemeEvent
{
if (!\array_key_exists('actions', $payload)) {
$payload['actions'] = [];
}
$themeEvent = new PageActionsEvent($user, $payload, $action);
$eventName = 'actions.' . $action;
if ($this->eventDispatcher->hasListeners($eventName)) {
$this->eventDispatcher->dispatch($themeEvent, $eventName);
}
return $themeEvent;
}
public function getJavascriptTranslations(): array
{
$event = new ThemeJavascriptTranslationsEvent();