mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #682 from creative-commoners/pulls/5.0/fix-fields-method
FIX Explicitly get the Fields() method from controller's data record
This commit is contained in:
commit
a0a73de277
@ -166,9 +166,9 @@ class UserDefinedFormController extends PageController
|
|||||||
|
|
||||||
$watch = [];
|
$watch = [];
|
||||||
|
|
||||||
if ($this->Fields()) {
|
if ($this->data()->Fields()) {
|
||||||
/** @var EditableFormField $field */
|
/** @var EditableFormField $field */
|
||||||
foreach ($this->Fields() as $field) {
|
foreach ($this->data()->Fields() as $field) {
|
||||||
if ($result = $field->formatDisplayRules()) {
|
if ($result = $field->formatDisplayRules()) {
|
||||||
$watch[] = $result;
|
$watch[] = $result;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ JS
|
|||||||
$attachments = array();
|
$attachments = array();
|
||||||
$submittedFields = ArrayList::create();
|
$submittedFields = ArrayList::create();
|
||||||
|
|
||||||
foreach ($this->Fields() as $field) {
|
foreach ($this->data()->Fields() as $field) {
|
||||||
if (!$field->showInReports()) {
|
if (!$field->showInReports()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class UserForm extends Form
|
|||||||
$fields = new UserFormsFieldList();
|
$fields = new UserFormsFieldList();
|
||||||
$target = $fields;
|
$target = $fields;
|
||||||
|
|
||||||
foreach ($this->controller->Fields() as $field) {
|
foreach ($this->controller->data()->Fields() as $field) {
|
||||||
$target = $target->processNext($field);
|
$target = $target->processNext($field);
|
||||||
}
|
}
|
||||||
$fields->clearEmptySteps();
|
$fields->clearEmptySteps();
|
||||||
@ -170,6 +170,7 @@ class UserForm extends Form
|
|||||||
// Generate required field validator
|
// Generate required field validator
|
||||||
$requiredNames = $this
|
$requiredNames = $this
|
||||||
->getController()
|
->getController()
|
||||||
|
->data()
|
||||||
->Fields()
|
->Fields()
|
||||||
->filter('Required', true)
|
->filter('Required', true)
|
||||||
->column('Name');
|
->column('Name');
|
||||||
|
Loading…
Reference in New Issue
Block a user