As part of our clients requirements, we need to add a dropdown field to the Insert Link dialog in Sitecore. Based on the selected Item in the content editor, this new field needs to query the tree to find the appropriate items to display in the dropdown. The problem I'm running into is that the insertLink dialog doesn't have access to the current item.
On a general link field, when the user clicks the "insert link" link, an ajax call is made to /sitecore/shell/Applications/Content-Editor?id=%7B1F6CECCF-4529-43F5-B6C2-0BE96502E6A7%7D&vs=4&la=en&sc_content=master&fo=%7B1F6CECCF-4529-43F5-B6C2-0BE96502E6A7%7D&ic=Apps%2F48x48%2FPencil.png&he=Content%20Editor&cl=0
As part of the post, the FormData contains __CurrentItem
which contains the ID of the selected item in the sitecore tree. Part of the json response from this call is the "ShowModalDialog".
{
"commands": [{
"command": "RegisterTranslation",
"value": "Please wait while the Content Editor is loading.",
"key": "Please wait while the Content Editor is loading."
}, {
"command": "SetPipeline",
"value": "0CF084774D7245F18E5B6C868F035B91"
}, {
"command": "ShowModalDialog",
"value": "/sitecore/shell/Applications/Dialogs/Internal link.aspx?hdl=FFE1AED9A4714489818A0F073EFD3987&ro&la=en&sc_content=master",
"features": "dialogWidth:685px;dialogHeight:600px;help:no;scroll:auto;resizable:yes;maximizable:yes;closable:yes;center:yes;status:no;header:;autoIncreaseHeight:yes;forceDialogSize:no",
"response": "1"
}
]}
As you can see, the ID is not passed along to the Internal Link.aspx.
Is there a Sitecore method somewhere that will return the currently selected item in the Sitecore tree? If not, any ideas on the best way to pass the ID into that dialog?