{"id":2353,"date":"2017-07-29T10:32:44","date_gmt":"2017-07-29T08:32:44","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=2353"},"modified":"2017-09-07T11:33:37","modified_gmt":"2017-09-07T09:33:37","slug":"where-is-the-edit-dropdown-in-the-search-hover-panel","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/where-is-the-edit-dropdown-in-the-search-hover-panel\/","title":{"rendered":"Where is the Edit dropdown in the search hover panel?"},"content":{"rendered":"<p>A recent assignment was to adjust the hover panel of search results. At the bottom, the footer, a menu item was wished for.<\/p>\n<p>The displaytemplate involved here was Item_CommonHoverPanel_Actions. This displaytemplate is responsible for displaying the menu items at the bottom of the hover.<\/p>\n<p>On an on prem environment the footer consists of an Edit menu item which consists of a dropdown with items like Download and Open in browser, and Follow, Send and View in library menu items as can be seen in figure 1.<\/p>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2355 size-full\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions.png\" alt=\"search_item_commonhoverpanel_actions\" width=\"859\" height=\"661\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions.png 859w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions-300x231.png 300w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions-768x591.png 768w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_Item_CommonHoverPanel_Actions-600x462.png 600w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><\/a><\/p>\n<p>Figure 1 &#8211; out of the box footer menu<\/p>\n<p>&nbsp;<\/p>\n<p>To add a menu item at the bottom a copy of this file was made, MyItem_CommonHoverPanel_Actions, without adding the custom link for now, just to make sure everything works without customizing. In an appropriate display template a link to this new actions file can be set\/overridden by using the HP.CommonActions property:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nif (typeof HP === &quot;undefined&quot;) {\r\nSP.SOD.executeFunc(&quot;searchui.js&quot;, &quot;HP_initialize&quot;, function () {\r\nHP.CommonActions = &quot;~sitecollection\/_catalogs\/masterpage\/Search\/Display Templates\/Custom Displaytemplates\/MyItem_CommonHoverPanel_Actions.js&quot;;\r\n});\r\n}\r\n<\/pre>\n<p>The changed displaytemplate is set to the Word resulttype and after refreshing the search results page the footer from MyItem_CommonHoverPanel_Actions can be seen in the hover panel, but\u2026 the edit dropdown is gone! Without even changing anything in the copied file!<\/p>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2359\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1.png\" alt=\"search_myitem_commonhoverpanel_actions\" width=\"856\" height=\"573\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1.png 856w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1-300x201.png 300w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1-768x514.png 768w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2017\/07\/Search_MyItem_CommonHoverPanel_Actions-1-600x402.png 600w\" sizes=\"auto, (max-width: 856px) 100vw, 856px\" \/><\/a><\/p>\n<p>Figure 2 &#8211; copy of the out of the box footer menu<\/p>\n<p>The html generates an accompanying js file where the rendering of the dropdown is present at the original Item_CommonHoverPanel_Actions, but not at MyItem_CommonHoverPanel_Actions.<\/p>\n<blockquote><p>It seems this file generates different js once it\u2019s copied, renamed and\/or replaced without making any adjustment in the file itself!<\/p><\/blockquote>\n<p>Fortunately there\u2019s another way to adjust the menu items in the footer AND keep the Edit dropdown.<\/p>\n<p>An item template loads a specific hoverpanel. In this file calls to render the header, body and footer are made. The rendering of the footer loads the Item_CommonHoverPanel_Actions, which we\u2019re not going to touch.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;div id=&quot;_#= $htmlEncode(id + HP.ids.actions) =#_&quot; class=&quot;ms-srch-hover-actions&quot;&gt;\r\n_#= ctx.RenderFooter(ctx) =#_\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>A new menu item can be rendered before or after the out of the box footer.<\/p>\n<p>I was unable to reproduce this behavior in an online environment. Online the edit dropdown isn\u2019t shown (or rendered in the accompanying js file) at all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A recent assignment was to adjust the hover panel of search results. At the bottom, the footer, a menu item was wished for. The displaytemplate involved here was Item_CommonHoverPanel_Actions. This displaytemplate is responsible for displaying the menu items at the &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/where-is-the-edit-dropdown-in-the-search-hover-panel\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[44],"class_list":["post-2353","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2013","tag-sharepoint-2013"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/2353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=2353"}],"version-history":[{"count":15,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/2353\/revisions"}],"predecessor-version":[{"id":2372,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/2353\/revisions\/2372"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=2353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=2353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=2353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}