Reading options in the SDL Tridion 2011 extension dialog box

I built a GUI extension to β€œenter” my own JavaScript in the SDL Tridion 2011 publishing dialog box (as explained in this post and comments: http://albertromkes.wordpress.com/2012/01/30/tridion-gui-extensions- how-to-load-a-javascript-without-showing-a-gui-element / )

I see in the SDL Tridion publish dialog box (publish.js) that the publish dialog accepts some parameters (not the URL), they are passed. For instance:

var p = this.properties; if (p.params && p.params.items && p.params.items.length > 0) 

So, in my JavaScript, I would like to get properties.params.items, but it seems like I can’t figure it out.

My JavaScript code is pasted after downloading the publication:

 <cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Popups.Publish"> <cfg:insertafter>Extensions.Resources</cfg:insertafter> </cfg:extension> 

And in my JavaScript (and Firebug Console) I tried to get the value using $display.getView().properties , but this returns a null object.

I used Firebug to view window , $display and various other objects, but I see no way to get to the params object.

My JavaScript looks like this:

 $evt.addEventHandler($display, "start", itemsForPublish); function itemsForPublish() { var p = $display.getView().properties; var items = p.params.items || []; alert(items); } 
+4
source share
1 answer

This should work:

 function itemsForPublish() { alert(window.dialogArguments.items); } 

In "Publishing.js" (and in "Publish.js") you can see that the items to publish are sent to the Pop-ups dialog box.

+7
source

Source: https://habr.com/ru/post/1402729/


All Articles