Skip to content

Commit

Permalink
added loginWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
kokspflanze committed Aug 6, 2015
1 parent 4b355f8 commit f8bbcc4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
'helper/topCharacterWidget' => __DIR__ . '/../view/helper/top-character.phtml',
'helper/topGuildWidget' => __DIR__ . '/../view/helper/top-guild.phtml',
'helper/playerHistory' => __DIR__ . '/../view/helper/player-history.phtml',
'helper/sidebarLoginWidget' => __DIR__ . '/../view/helper/login-widget.phtml',
'zfc-ticket-system/new' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/new.twig',
'zfc-ticket-system/view' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/view.twig',
'zfc-ticket-system/index' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/index.twig',
Expand Down
3 changes: 3 additions & 0 deletions src/PServerCMS/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public function getViewHelperConfig()
'loggedInWidgetPServerCMS' => function ( AbstractPluginManager $pluginManager ) {
return new View\Helper\LoggedInWidget( $pluginManager->getServiceLocator() );
},
'loginWidgetPServerCMS' => function ( AbstractPluginManager $pluginManager ) {
return new View\Helper\LoginWidget( $pluginManager->getServiceLocator() );
},
'serverInfoWidgetPServerCMS' => function ( AbstractPluginManager $pluginManager ) {
return new View\Helper\ServerInfoWidget( $pluginManager->getServiceLocator() );
},
Expand Down
28 changes: 28 additions & 0 deletions src/PServerCMS/View/Helper/LoginWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php


namespace PServerCMS\View\Helper;

use Zend\View\Model\ViewModel;

class LoginWidget extends InvokerBase
{
/**
* @return string
*/
public function __invoke()
{
$template = '';

if (!$this->getAuthService()->hasIdentity()) {
$viewModel = new ViewModel([
'loginForm' => $this->getUserService()->getLoginForm(),
]);
$viewModel->setTemplate('helper/sidebarLoginWidget');
$template = $this->getView()->render($viewModel);
}

return $template;
}

}
1 change: 1 addition & 0 deletions view/helper/login-widget.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?= $this->formWidget($this->loginForm); ?>

0 comments on commit f8bbcc4

Please sign in to comment.