From cb4323e51cb70cc1e9cf3b412aa382031e1ef072 Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Thu, 18 Feb 2016 17:35:57 +0530
Subject: [PATCH] Custom HEADERLINK supported on layout.

---
 modules/Vtiger/views/Header.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/Vtiger/views/Header.php b/modules/Vtiger/views/Header.php
index 1051ed4de..7cffac2a3 100644
--- a/modules/Vtiger/views/Header.php
+++ b/modules/Vtiger/views/Header.php
@@ -144,10 +144,15 @@ abstract class Vtiger_Header_View extends Vtiger_View_Controller {
 			}
 			$headerLinkInstances[$index++] = $headerLinkInstance;
 		}
+
+		// Fix for http://code.vtiger.com/vtiger/vtigercrm/issues/49
+		// Push HEADERLINKS to drop-down menu shown with username (last-one) as structured above.
+		$lastindex = count($headerLinkInstances)-1;
 		$headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERLINK'));
+		if ($headerLinks) $headerLinkInstances[$lastindex]->addChildLink(Vtiger_Link_Model::getInstanceFromValues(array())); // Separator
 		foreach($headerLinks as $headerType => $headerLinks) {
 			foreach($headerLinks as $headerLink) {
-				$headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
+				$headerLinkInstances[$lastindex]->addChildLink(Vtiger_Link_Model::getInstanceFromLinkObject($headerLink));
 			}
 		}
 		return $headerLinkInstances;
-- 
GitLab