public
Created

create a PortletURL in PHP

  • Download Gist
portlet_url.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?php
/*
* You need the fix from:
* http://issues.liferay.com/browse/LPS-22161
* (git 8f7c48746f9282e6037112220f9232786747d896)
*/
 
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.util.PortletKeys;
import com.liferay.portlet.PortletURLFactoryUtil;
 
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
import javax.portlet.WindowState;
 
$request = quercus_servlet_request();
 
$themeDisplay = $request->getAttribute(WebKeys::THEME_DISPLAY);
 
$myAccountURL = PortletURLFactoryUtil::create(
$request, PortletKeys::MY_ACCOUNT, $themeDisplay->getPlid(),
PortletRequest::RENDER_PHASE);
 
$myAccountURL->setWindowState(WindowState::MAXIMIZED);
$myAccountURL->setPortletMode(PortletMode::VIEW);
 
$myAccountURL->setParameter("struts_action", "/my_account/edit_user");
?>
 
<a href="<?php echo $myAccountURL->toString(); ?>">My Account</a>
 
<?php include("navigation.php"); ?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.