From 4776b9075de8f3f0052c0fd25678931506bae7c2 Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Mon, 28 Aug 2017 12:07:24 +0200 Subject: [PATCH] Pass all button options directly to LoginButtonEvent::addButton() --- Event/LoginButtonEvent.php | 14 +++++++------- Resources/views/Login/buttons.html.twig | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Event/LoginButtonEvent.php b/Event/LoginButtonEvent.php index 78274be..00b4c86 100644 --- a/Event/LoginButtonEvent.php +++ b/Event/LoginButtonEvent.php @@ -27,14 +27,14 @@ class LoginButtonEvent extends Event { private $buttons = []; - public function addButton($text, $linkTarget, $style = 'default', $icon = null) + public function addButton($options) { - $this->buttons[] = [ - 'text' => $text, - 'target' => $linkTarget, - 'style' => $style, - 'icon' => $icon, - ]; + $this->buttons[] = $options + [ + 'style' => 'default', + 'icon' => null, + 'url' => null, + 'route' => null, + ]; } public function getButtons() diff --git a/Resources/views/Login/buttons.html.twig b/Resources/views/Login/buttons.html.twig index adb842b..27397cf 100644 --- a/Resources/views/Login/buttons.html.twig +++ b/Resources/views/Login/buttons.html.twig @@ -1,10 +1,10 @@
{% for button in buttons %} - - {% if icon %} - {{ icon(icon) }} + + {% if button.icon %} + {{ icon(button.icon) }} {% endif %} - {{ button.text }} + {{ button.label }} {% endfor %}