mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: removed ConfirmedFormAction
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@93674 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
05832a1dee
commit
bbb3378f28
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Action button with confirmation text.
|
||||
* These button are useful for things like delete buttons.
|
||||
*
|
||||
* @deprecated 2.3 Instead of using ConfirmedFormAction, just
|
||||
* apply a simple javascript event handler to your standard
|
||||
* FormAction form fields.
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage actions
|
||||
*/
|
||||
class ConfirmedFormAction extends FormAction {
|
||||
protected $confirmation;
|
||||
|
||||
/**
|
||||
* Create a new action button.
|
||||
* @param action The method to call when the button is clicked
|
||||
* @param title The label on the button
|
||||
* @param confirmation The message to display in the confirmation box
|
||||
* @param form The parent form, auto-set when the field is placed inside a form
|
||||
*/
|
||||
function __construct($action, $title = "", $confirmation = null, $form = null) {
|
||||
if($confirmation) {
|
||||
$this->confirmation = $confirmation;
|
||||
} else {
|
||||
$this->confirmation = _t('ConfirmedFormAction.CONFIRMATION', "Are you sure?", PR_MEDIUM, 'Confirmation popup before executing the form action');
|
||||
}
|
||||
|
||||
parent::__construct($action, $title, $form);
|
||||
}
|
||||
|
||||
function Field() {
|
||||
$attributes = array(
|
||||
'type' => 'submit',
|
||||
'class' => ($this->extraClass() ? $this->extraClass() : ''),
|
||||
'id' => $this->id(),
|
||||
'name' => $this->Name(),
|
||||
'value' => $this->attrTitle(),
|
||||
'tabindex' => $this->getTabIndex(),
|
||||
'onclick' => "return confirm('$this->confirmation');"
|
||||
);
|
||||
|
||||
return $this->createTag('input', $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user