This is what I did by expanding the Save button:
<cfg:groups> <cfg:group name="ValidateTitleField.CommandSet"> <cfg:fileset> <cfg:file type="script">/Commands/ValidateTitleFieldCommand.js</cfg:file> <cfg:file type="reference">ValidateTitleField.Interface</cfg:file> </cfg:fileset> <cfg:dependencies> <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency> <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency> </cfg:dependencies> </cfg:group> <cfg:group name="ValidateTitleField.Views.ValidateTitleFieldPopup"> <cfg:fileset> <cfg:file type="script">/Views/ValidateTitleFieldPopup.js</cfg:file> <cfg:file type="style">/Views/ValidateTitleFieldPopup.css</cfg:file> </cfg:fileset> <cfg:dependencies> <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency> <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency> </cfg:dependencies> </cfg:group> </cfg:groups>
[...]
<ext:editorextension target="CME"> <ext:editurls /> <ext:listdefinitions /> <ext:taskbars /> <ext:commands /> <ext:commandextensions> <ext:commands> <ext:command name="Save" extendingcommand="ValidateTitleField"/> </ext:commands> <ext:dependencies> <cfg:dependency>ValidateTitleField.CommandSet</cfg:dependency> </ext:dependencies> </ext:commandextensions> <ext:contextmenus /> <ext:lists /> <ext:tabpages /> <ext:toolbars /> <ext:ribbontoolbars /> </ext:editorextension>
[...]
<commands> <cfg:commandset id="ValidateTitleField.Interface"> <cfg:command name="ValidateTitleField" implementation="Company.Extensions.ValidateTitleFieldCommand"/> </cfg:commandset> </commands>
Then, in my implementation of the (JS) command, I used the following to call the "original" methods:
Company.Extensions.ValidateTitleFieldCommand.prototype._isAvailable = function ValidateTitleFieldCommand$_isAvailable(selection) { console.debug("Is Available called"); return $cme.getCommand("Save")._isAvailable(selection); };
And finally, somewhere deep in the _execute method:
if (!failed) return $cme.getCommand("Save")._execute(selection, pipeline); else { this.loadPopup(); }
Hope this helps,
N
source share