public function switchUser($row, $href, $label, $title, $icon)
	{
		$authorizationChecker = Contao\System::getContainer()->get('security.authorization_checker');

		if (!$authorizationChecker->isGranted('ROLE_ALLOWED_TO_SWITCH') || $authorizationChecker->isGranted('ROLE_PREVIOUS_ADMIN'))
		{
			return '';
		}

		if ($this->User->id == $row['id'])
		{
			return Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' ';
		}

		$router = Contao\System::getContainer()->get('router');
		$url = $router->generate('contao_backend', array('_switch_user'=>$row['username']));

		return '<a href="'.$url.'" title="'.Contao\StringUtil::specialchars($title).'">'.Contao\Image::getHtml($icon, $label).'</a> ';
	}
public function switchUser($row, $href, $label, $title, $icon)
	{
		$authorizationChecker = Contao\System::getContainer()->get('security.authorization_checker');

		if (!$authorizationChecker->isGranted('ROLE_ALLOWED_TO_SWITCH') || $authorizationChecker->isGranted('ROLE_PREVIOUS_ADMIN'))
		{
			return '';
		}

		if ($this->User->id == $row['id'])
		{
			return Contao\Image::getHtml(preg_replace('/\.svg$/i', '_.svg', $icon)).' ';
		}

		$router = Contao\System::getContainer()->get('router');
		$url = $router->generate('contao_backend', array('_switch_user'=>$row['username']));

		return '<a href="'.$url.'" title="'.Contao\StringUtil::specialchars($title).'">'.Contao\Image::getHtml($icon, $label).'</a> ';
	}
public function switchUser ( $ row , $ href , $ label , $ title , $ icon ) { $ authorizationChecker = Contao \ System :: getContainer ( ) -> get ( 'security.authorization_checker' ) ; if ( ! $ authorizationChecker -> isGranted ( 'ROLE_ALLOWED_TO_SWITCH' ) || $ authorizationChecker -> isGranted ( 'ROLE_PREVIOUS_ADMIN' ) ) { return '' ; } if ( $ this -> User -> id == $ row [ 'id' ] ) { return Contao \ Image :: getHtml ( preg_replace ( '/\.svg$/i' , '_.svg' , $ icon ) ) . ' ' ; } $ router = Contao \ System :: getContainer ( ) -> get ( 'router' ) ; $ url = $ router -> generate ( 'contao_backend' , array ( '_switch_user' => $ row [ 'username' ] ) ) ; return '<a href="' . $ url . '" title="' . Contao \ StringUtil :: specialchars ( $ title ) . '">' . Contao \ Image :: getHtml ( $ icon , $ label ) . '</a> ' ; }
Generate a "switch account" button and return it as string

@param array  $row
@param string $href
@param string $label
@param string $title
@param string $icon

@return string

@throws Exception
Generate a switch account button and return it as string