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:
Dylan Wagstaff 2017-11-01 17:04:21 +13:00 committed by GitHub
commit a0a73de277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -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;
} }

View File

@ -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');