I have a custom GUI extension working that lets me override the Save command (see Rob's article http://www.curlette.com/?p=913).
Ideally I want to hide the button altogether when in the Component UI view - for which there does appear to be a doHide() method on the Tridion.Controls.RibbonButton
itself which works well when I tested in Chrome Dev Tools.
What I can't figure is how to get to the Save button in order to call doHide()?
The following gives me all the controls on the ribbon bar
$display.getWindow().$controls.controls["Tridion.Controls.RibbonButton"]
Of which an object called UID_63 is the Save button:
So this works:
$display.getWindow().$controls.controls["Tridion.Controls.RibbonButton"].UID_63.doHide();
But there must be a nicer way than knowing that UID number?
There is a hasControl() method but I can only ever get false out of it:
$display.getWindow().$controls.hasControl("SaveBtn");
And the getControl() method seems to be for adding new controls, not getting current ones?
$display.getWindow().$controls.getControl(n, f, i);
Cheers
var controls = $display.getView().getWindow().$controls.getAllControls("Tridion.Controls.RibbonButton")
. And then:for (var key in controls) { var id = controls[key].getId(); if (id == "SaveBtn") { controls[key].doHide(); } }
I'm sure there's a more elegant way to solve this, but this might be a good start$display.getView().getWindow().$controls.getControl($("#SaveBtn"), "Tridion.Controls.RibbonButton").doHide()
:)