The closest I got using this code (in the component editing window):
$display.getView().getSourceEditorName()
This will return the name of the current field , although the method name assumes that it is doing something else.
If you want to get the same value from your popup, name it opener
as follows:
opener.$display.getView().getSourceEditorName()
The best decision
Instead of looking for the field name from the popup, you should pass it to your popup as an argument when invoking your command. You can get it from the target
parameter, which is passed to the _execute
method of your command.
GUI.Extension.prototype._execute = function GUI$Extension$_execute(target) { target.editor.setFocus(); var fieldName = target.item.getSourceEditorName(); var popup = $popup.create("/WebUI/Editors/GUI.Extensions/Extension.aspx", "width=400px,height=150px,resizable=0", { fieldName: fieldName }); }
And then read it in a popup javascript using:
var fieldName = window.dialogArguments.fieldName;
source share