diff --git a/forms/FormAction.php b/forms/FormAction.php index 712003114..943f8c9b0 100644 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -73,6 +73,10 @@ class FormAction extends FormField { ); return $this->customise($properties)->renderWith($this->getTemplate()); } + + function FieldHolder() { + return $this->Field(); + } public function Type() { return 'action'; diff --git a/tests/forms/FieldListTest.php b/tests/forms/FieldListTest.php index 98b0bf7d1..03258a848 100644 --- a/tests/forms/FieldListTest.php +++ b/tests/forms/FieldListTest.php @@ -725,7 +725,20 @@ class FieldListTest extends SapphireTest { ); $this->assertEquals($a->FieldHolder() . $b->FieldHolder(), $set->forTempalte()); + } + + /** + * FieldList::forTemplate() for an action list returns a concatenation of Field values. + * Internally, this works by having FormAction::FieldHolder return just the field, but it's an important + * use-case to test. + */ + function testForTemplateForActionList() { + $set = new FieldList( + $a = new FormAction('A'), + $b = new FormAction('B') + ); + $this->assertEquals($a->Field() . $b->Field(), $set->forTempalte()); } function testMakeFieldReadonly() {