Change the text on the "Save" button

6 posts by 2 authors in: Forums > CMS Builder
Last Post: May 11, 2012   (RSS)

Hello,

I would like to change the default text from "Save" to "Save & Exit" on the create listing page.

I think this is clearer than just "Save" as I am using the Add Apply Button plug-in, which I have renamed to "Save & Continue Editing".

Can you please tell me where I can find the code for the "Save" button?

<input class='button' type='submit' name='_action=save' value='Save' />

Thank you for your help.

Regards,
Greg

Re: [gversion] Change the text on the "Save" button

By Jason - December 23, 2011

Hi Greg,

Sure, if you open up cmsAdmin/lib/menus/default/edit.php, you'll find this code around line 60 (v2.13)

$buttonsRight .= "<input class='button' type='submit' name='_action=save' value='" .t('Save'). "' />\n";

Just change t('Save') to t('Save & Exit').

Note: this change will be overwritten if you upgrade your copy of CMS Builder.

hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Change the text on the "Save" button

Hi Jason,

That's excellent! Thanks for your help.

Regards,
Greg

Re: [gversion] Change the text on the "Save" button

By gversion - May 11, 2012

Hi Jason,

Would it be possible to build a plug-in that would let me define the text for a button on a certain section editor?

So, for example in one section editor I will have the button text display "Save" and on another section editor (where I can compose/send emails) I would change the "Save" text be "Send".

If a plug0in can achieve this then could you please point me in the right direction as I'd like to try and take on this challenge myself.

Thank you,
Greg

Re: [gversion] Change the text on the "Save" button

By Jason - May 11, 2012

Hi Greg,

You can use the plugin filter "edit_buttonsRight" to accomplish this.

If you open up cmsAdmin/lib/menus/default/edit.php you'll see this block of code:

<?php
$buttonsRight = '';
$buttonsRight .= "<input class='button' type='submit' name='_action=save' value='" .t('Save'). "' />\n";
if ($previewUrl) {
$buttonsRight .= "<input class='button' type='button' name='preview' value='" .t('Preview'). "' onclick=\"editPreview();\" />\n";
}
$buttonsRight .= "<input class='button' type='button' name='cancel' value='" .t('Cancel'). "' onclick=\"editCancel();\" />\n";
$buttonsRight = applyFilters('edit_buttonsRight', $buttonsRight, $tableName, $GLOBALS['RECORD']);
echo $buttonsRight;
?>


This is the code that creates the buttons seen on the edit page. Just before the html string is echoed to the screen, it passes it's value to the any plugin that uses the edit_buttonsRight filter. So you can create a plugin using this filter that edits this HTML string and returns a new value.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/