User profile layout (#2402)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user