Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AdminBundle] Add support for csrf token on logout url in admin inter…
…face
- Loading branch information
Showing
8 changed files
with
133 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPGRADE FROM 6.1 to 6.2 | ||
======================== | ||
|
||
AdminBundle | ||
----------- | ||
|
||
* Not passing a value for "$logoutUrlGenerator" in "Kunstmaan\AdminBundle\Helper\AdminPanel\DefaultAdminPanelAdaptor::__construct" is deprecated and will be required in 7.0. |
52 changes: 52 additions & 0 deletions
52
src/Kunstmaan/AdminBundle/Helper/AdminPanel/AdminPanelLogoutAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kunstmaan\AdminBundle\Helper\AdminPanel; | ||
|
||
final class AdminPanelLogoutAction implements AdminPanelActionInterface | ||
{ | ||
/** @var string */ | ||
private $logoutUrl; | ||
/** @var string|null */ | ||
private $icon; | ||
/** @var string */ | ||
private $label; | ||
/** @var string */ | ||
private $template = '@KunstmaanAdmin/AdminPanel/_admin_panel_logout_action.html.twig'; | ||
|
||
public function __construct(string $url, string $label, ?string $icon = null, ?string $template = null) | ||
{ | ||
$this->logoutUrl = $url; | ||
$this->label = $label; | ||
$this->icon = $icon; | ||
if (!empty($template)) { | ||
$this->template = $template; | ||
} | ||
} | ||
|
||
public function getLogoutUrl(): string | ||
{ | ||
return $this->logoutUrl; | ||
} | ||
|
||
public function getUrl(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getIcon(): ?string | ||
{ | ||
return $this->icon; | ||
} | ||
|
||
public function getLabel(): string | ||
{ | ||
return $this->label; | ||
} | ||
|
||
public function getTemplate(): string | ||
{ | ||
return $this->template; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Kunstmaan/AdminBundle/Resources/views/AdminPanel/_admin_panel_logout_action.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<li> | ||
<a href="{{ action.getLogoutUrl() }}"> | ||
{% if action.getIcon() is not null %} | ||
<i class="fa fa-{{ action.getIcon() }}"></i> | ||
{% endif %} | ||
{% if (action.getLabel()) is not empty %} | ||
| ||
{{ action.getLabel() }} | ||
{% endif %} | ||
</a> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters