Can we change the order of the activity buttons at the top of CMSB interface (like on a record editing page)?
5 posts by 3 authors in: Forums > CMS Builder
Last Post: 4 hours ago (RSS)
By Codee - Yesterday at 3:56pm
My customer's buttons at the top of a record editor page is erase > save and copy >preview > cancel > save (see screenshot attached). I know it's a "small" issue but it changed order after updating his cmsb versio from 3.77 to 3.84. He's kind of an older guy (78 yrs) and sometimes small changes can upset him a bit - but he's a fabulous guy so if I can easily rearrange the order for him (and keep it from future changes?) it would be a good thing to do for him.
Thank you in advance!
By Dave - Yesterday at 4:33pm - edited: Yesterday at 4:34pm
Hi Codee,
Happy to help with this one. In v3.83 we standardized the button order across all the admin pages: destructive actions (like Erase) on the far left, and the primary action (Save) always on the far right with Cancel beside it. That follows the convention Mac, iOS, and Android all use, but I can see how a change like that would throw off someone who's had years of muscle memory with the old layout.
I've attached a plugin that restores the buttons to their previous order (Cancel, Erase, Preview, Save). Just upload it to your cmsb/plugins/ folder and activate it under Admin → Plugins.
If your customer wants a different arrangement, there's a single line at the top of the plugin you can edit:
// Buttons appear left to right in the order below - rearrange as desired
// '*' is where buttons added by other plugins appear, e.g. "Save & Copy".
$buttonOrder = ['cancel', 'Erase', 'preview', '*', '_action=save'];
Rearrange those as desired. The '*' is where buttons added by other plugins (like Save & Copy) appear.
And good news on the "keep it from future changes" part: the plugin re-sorts whatever buttons the CMS generates, so the order will stick through future updates.
Let me know if that works for him!
Dave
interactivetools.com
By Codee - Yesterday at 6:22pm
Hi Dave,
It ALMOST works perfectly...I changed the top line order to be:
$buttonOrder = ['_action=save', 'preview', '*', 'Erase', 'cancel'];
but the "save and copy" button appears first...does it have to do with the '_action=' placement?
He prefers the following visual order: save > preview > save and copy > erase > cancel
Thank you kindly! This is awesome.
By Christine - 6 hours ago
Hi Codee,
does it have to do with the '_action=' placement?
That's exactly it - it's the '_action=save' that's doing it.
So '_action=save' is the internal name of the Save button, and the Save & Copy plugin gives its own button that exact same internal name as well.
While the ordering plugin was matching on names, it saw two buttons called _action=save and kept them together, which is why Save & Copy came along with Save when you moved it to the front.
I've attached an updated version of the plugin Dave posted that matches on the label shown on the button instead. The labels are all distinct, so Save & Copy can now sit wherever you'd like.
For the specific order your customer wants:
$buttonOrder = ['Save', 'Preview', 'Save & Copy', 'Erase', 'Cancel'];
Let me know if that works for him!
interactivetools.com