mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API FormField::name_to_label() for unlabelled fields
Will convert camel case to spaces, e.g. "TotalAmount" to "Total Amount".
This commit is contained in:
parent
92e62ebb91
commit
aa6f345d1d
@ -125,7 +125,7 @@ class FormField extends RequestHandler {
|
||||
*/
|
||||
public function __construct($name, $title = null, $value = null) {
|
||||
$this->name = $name;
|
||||
$this->title = ($title === null) ? $name : $title;
|
||||
$this->title = ($title === null) ? self::name_to_label($name) : $title;
|
||||
|
||||
if($value !== NULL) $this->setValue($value);
|
||||
|
||||
|
@ -211,7 +211,7 @@ class FormTest extends FunctionalTest {
|
||||
$this->assertPartialMatchBySelector(
|
||||
'#SomeRequiredField span.required',
|
||||
array(
|
||||
'"SomeRequiredField" is required'
|
||||
'"Some Required Field" is required'
|
||||
),
|
||||
'Required fields show a notification on field when left blank'
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user