Commit 1b25075a authored by David Surville's avatar David Surville
Browse files

Bug sur la récupération du role dans l'aide de vue

parent a81033a2
<?php
namespace UnicaenAuth\View\Helper;
use Application\Acl\Role;
use Zend\Permissions\Acl\Role\RoleInterface;
use Zend\Form\Element\Radio;
/**
......@@ -14,7 +14,7 @@ use Zend\Form\Element\Radio;
class UserProfileSelectRadioItem extends UserAbstract
{
/**
* @var Role
* @var RoleInterface
*/
protected $role;
......@@ -30,11 +30,11 @@ class UserProfileSelectRadioItem extends UserAbstract
/**
*
* @param Role $role
* @param RoleInterface $role
* @param bool $selected
* @return self
*/
public function __invoke(Role $role, $selected = false)
public function __invoke(RoleInterface $role, $selected = false)
{
$this->role = $role;
$this->selected = $selected;
......@@ -74,10 +74,12 @@ class UserProfileSelectRadioItem extends UserAbstract
$id = $this->role->getRoleId();
$inputClass = 'user-profile-select-input';
$roleToString = method_exists($this->role, '__toString') ? (string) $this->role : $this->role->getRoleId();
// rendu sous forme de radio
$radio = new Radio('role');
$radio
->setValueOptions(array($id => (string) $this->role))
->setValueOptions(array($id => $roleToString))
->setAttribute('class', $inputClass)
->setAttribute('title', "Cliquez pour changer de profil courant")
->setValue($this->selected ? $id : null);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment