mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #5665 from tractorcow/pulls/3.3/fix-button-clicked
BUG Fix buttonClicked() error
This commit is contained in:
commit
a64a066bbf
@ -1635,11 +1635,17 @@ class Form extends RequestHandler {
|
|||||||
* @return FormAction
|
* @return FormAction
|
||||||
*/
|
*/
|
||||||
public function buttonClicked() {
|
public function buttonClicked() {
|
||||||
foreach($this->actions->dataFields() as $action) {
|
$actions = $this->actions->dataFields();
|
||||||
if($action->hasMethod('actionname') && $this->buttonClickedFunc == $action->actionName()) {
|
if(!$actions) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($actions as $action) {
|
||||||
|
if($action instanceof FormAction && $this->buttonClickedFunc == $action->actionName()) {
|
||||||
return $action;
|
return $action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,6 +537,12 @@ class FormTest extends FunctionalTest {
|
|||||||
$this->assertEquals('bar', $attrs['foo']);
|
$this->assertEquals('bar', $attrs['foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testButtonClicked() {
|
||||||
|
$form = $this->getStubForm();
|
||||||
|
$action = $form->buttonClicked();
|
||||||
|
$this->assertNull($action);
|
||||||
|
}
|
||||||
|
|
||||||
public function testAttributesHTML() {
|
public function testAttributesHTML() {
|
||||||
$form = $this->getStubForm();
|
$form = $this->getStubForm();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user