silverstripe/silverstripe-userforms

Make form actions editable, the same way that fields are editable

Closed this issue · 1 comments

Description

Currently actions for the front-end form can only be modified in code. It might be desirable to be able to edit these (e.g. edit the display text) in the CMS.

See:

* @todo Make form actions editable via their own field editor.
*
* @return FieldList
*/
public function getFormActions()
{
$submitText = ($this->controller->SubmitButtonText)
? $this->controller->SubmitButtonText
: _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SUBMITBUTTON', 'Submit');
$clearText = ($this->controller->ClearButtonText)
? $this->controller->ClearButtonText
: _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.CLEARBUTTON', 'Clear');
$actions = FieldList::create(FormAction::create('process', $submitText));
if ($this->controller->ShowClearButton) {
$actions->push(FormAction::create('clearForm', $clearText)->setAttribute('type', 'reset'));
}
$this->extend('updateFormActions', $actions);
$actions->setForm($this);
return $actions;
}

I'm going to close this as "won't do" - there's no way to allow CMS authors to modify the functionality of these actions, and allowing them to edit the text would likely result in inconsistencies for translated values. I don't see any value in implementing this.