Skip to content

Commit ca25ed8

Browse files
committed
fixes #686: alterFieldValues() in all ParentType bugfix
1 parent f424309 commit ca25ed8

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/Kris/LaravelFormBuilder/Fields/CollectionType.php

+17
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ public function getAllAttributes()
7171
return $this->parent->getFormHelper()->mergeAttributes($this->children);
7272
}
7373

74+
/**
75+
* Allow form-specific value alters.
76+
*
77+
* @param array $values
78+
* @return void
79+
*/
80+
public function alterFieldValues(array &$values)
81+
{
82+
foreach ($this->children as $i => $child) {
83+
if (method_exists($child, 'alterFieldValues')) {
84+
if (isset($values[$i])) {
85+
$child->alterFieldValues($values[$i]);
86+
}
87+
}
88+
}
89+
}
90+
7491
/**
7592
* @inheritdoc
7693
*/

src/Kris/LaravelFormBuilder/Fields/ParentType.php

-17
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,4 @@ public function getValidationRules()
200200

201201
return $rules->append($childrenRules);
202202
}
203-
204-
/**
205-
* Allow form-specific value alters.
206-
*
207-
* @param array $values
208-
* @return void
209-
*/
210-
public function alterFieldValues(array &$values)
211-
{
212-
foreach ($this->children as $i => $child) {
213-
if (method_exists($child, 'alterFieldValues')) {
214-
if (isset($values[$i])) {
215-
$child->alterFieldValues($values[$i]);
216-
}
217-
}
218-
}
219-
}
220203
}

0 commit comments

Comments
 (0)