mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
ENH Avoid use of 'new' keyword on injectable classes from this module.
It's not uncommon to want to override or enhance some functionality in vendor code that doesn't have extension points, so we should avoid the `new` keyword when instantiating injectable classes from the module.
This commit is contained in:
parent
4d9e78a841
commit
3fbccea2ea
@ -118,7 +118,7 @@ class UserForm extends Form
|
||||
*/
|
||||
public function getFormFields()
|
||||
{
|
||||
$fields = new UserFormsFieldList();
|
||||
$fields = UserFormsFieldList::create();
|
||||
$target = $fields;
|
||||
|
||||
foreach ($this->controller->data()->Fields() as $field) {
|
||||
@ -174,7 +174,7 @@ class UserForm extends Form
|
||||
->filter('Required', true)
|
||||
->column('Name');
|
||||
$requiredNames = array_merge($requiredNames, $this->getEmailRecipientRequiredFields());
|
||||
$required = new UserFormsRequiredFields($requiredNames);
|
||||
$required = UserFormsRequiredFields::create($requiredNames);
|
||||
$this->extend('updateRequiredFields', $required);
|
||||
$required->setForm($this);
|
||||
return $required;
|
||||
|
Loading…
Reference in New Issue
Block a user