mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT GridFieldPopupForms->setValidator()
This commit is contained in:
parent
8a4a6efe29
commit
40abab8aec
@ -25,6 +25,11 @@ class GridFieldPopupForms implements GridField_URLHandler {
|
|||||||
*/
|
*/
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Validator The form validator used for both add and edit fields.
|
||||||
|
*/
|
||||||
|
protected $validator;
|
||||||
|
|
||||||
function getURLHandlers($gridField) {
|
function getURLHandlers($gridField) {
|
||||||
return array(
|
return array(
|
||||||
'item/$ID' => 'handleItem',
|
'item/$ID' => 'handleItem',
|
||||||
@ -76,6 +81,7 @@ class GridFieldPopupForms implements GridField_URLHandler {
|
|||||||
*/
|
*/
|
||||||
function setTemplate($template) {
|
function setTemplate($template) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,6 +96,7 @@ class GridFieldPopupForms implements GridField_URLHandler {
|
|||||||
*/
|
*/
|
||||||
function setName($name) {
|
function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,6 +105,21 @@ class GridFieldPopupForms implements GridField_URLHandler {
|
|||||||
function getName() {
|
function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Validator $validator
|
||||||
|
*/
|
||||||
|
public function setValidator(Validator $validator) {
|
||||||
|
$this->validator = $validator;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Validator
|
||||||
|
*/
|
||||||
|
public function getValidator() {
|
||||||
|
return $this->validator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
||||||
@ -205,7 +227,8 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
|||||||
->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'),
|
->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'),
|
||||||
FormAction::create('doDelete', _t('GridFieldDetailsForm.Delete', 'Delete'))
|
FormAction::create('doDelete', _t('GridFieldDetailsForm.Delete', 'Delete'))
|
||||||
->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive')
|
->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive')
|
||||||
)
|
),
|
||||||
|
$this->component->getValidator()
|
||||||
);
|
);
|
||||||
$form->loadDataFrom($this->record);
|
$form->loadDataFrom($this->record);
|
||||||
|
|
||||||
@ -284,6 +307,7 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
|||||||
*/
|
*/
|
||||||
function setTemplate($template) {
|
function setTemplate($template) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user