User profile layout (#2402)
This commit is contained in:
@@ -24,6 +24,7 @@ final class IconExtension extends AbstractExtension
|
||||
'audit' => 'fas fa-history',
|
||||
'avatar' => 'fas fa-user',
|
||||
'back' => 'fas fa-long-arrow-alt-left',
|
||||
'barcode' => 'fas fa-barcode',
|
||||
'calendar' => 'far fa-calendar-alt',
|
||||
'clock' => 'far fa-clock',
|
||||
'comment' => 'far fa-comment',
|
||||
@@ -51,6 +52,7 @@ final class IconExtension extends AbstractExtension
|
||||
'left' => 'fas fa-chevron-left',
|
||||
'list' => 'fas fa-list',
|
||||
'locked' => 'fas fa-lock',
|
||||
'login' => 'fas fa-sign-in-alt',
|
||||
'logout' => 'fas fa-sign-out-alt',
|
||||
'mail' => 'fas fa-envelope-open',
|
||||
'mail-sent' => 'fas fa-paper-plane',
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -28,6 +28,7 @@ class RuntimeExtensions extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
new TwigFunction('trigger', [ThemeExtension::class, 'trigger'], ['needs_environment' => true]),
|
||||
new TwigFunction('actions', [ThemeExtension::class, 'actions']),
|
||||
new TwigFunction('javascript_translations', [ThemeExtension::class, 'getJavascriptTranslations']),
|
||||
new TwigFunction('timesheet_exporter', [ExporterExtension::class, 'getTimesheetExporter']),
|
||||
new TwigFunction('active_timesheets', [TimesheetExtension::class, 'activeEntries']),
|
||||
|
||||
Reference in New Issue
Block a user