@@ 168-179 (lines=12) @@ | ||
165 | }, $keys)); |
|
166 | ||
167 | if ($field instanceof Field\Embeds) { |
|
168 | $newRules = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
169 | list($r, $k, $c) = explode('.', $v); |
|
170 | $v = "{$r}.{$k}"; |
|
171 | $embed = $field->getValidationRules([$field->column() => $availInput[$k][$c]]); |
|
172 | ||
173 | return $embed ? $array_key_attach_str($embed, $v) : null; |
|
174 | }, $newColumn); |
|
175 | $rules = $array_clean_merge($rules, array_filter($newRules)); |
|
176 | ||
177 | $newAttributes = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
178 | list($r, $k, $c) = explode('.', $v); |
|
179 | $v = "{$r}.{$k}"; |
|
180 | $embed = $field->getValidationAttributes([$field->column() => $availInput[$k][$c]]); |
|
181 | ||
182 | return $embed ? $array_key_attach_str($embed, $v) : null; |
|
@@ 177-188 (lines=12) @@ | ||
174 | }, $newColumn); |
|
175 | $rules = $array_clean_merge($rules, array_filter($newRules)); |
|
176 | ||
177 | $newAttributes = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
178 | list($r, $k, $c) = explode('.', $v); |
|
179 | $v = "{$r}.{$k}"; |
|
180 | $embed = $field->getValidationAttributes([$field->column() => $availInput[$k][$c]]); |
|
181 | ||
182 | return $embed ? $array_key_attach_str($embed, $v) : null; |
|
183 | }, $newColumn); |
|
184 | $attributes = $array_clean_merge($attributes, array_filter($newAttributes)); |
|
185 | ||
186 | $newInput = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
187 | list($r, $k, $c) = explode('.', $v); |
|
188 | $v = "{$r}.{$k}"; |
|
189 | $embed = $field->getValidationInput([$field->column() => $availInput[$k][$c]]); |
|
190 | ||
191 | return $embed ? $array_key_attach_str($embed, $v) : [null => 'null']; |
|
@@ 186-197 (lines=12) @@ | ||
183 | }, $newColumn); |
|
184 | $attributes = $array_clean_merge($attributes, array_filter($newAttributes)); |
|
185 | ||
186 | $newInput = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
187 | list($r, $k, $c) = explode('.', $v); |
|
188 | $v = "{$r}.{$k}"; |
|
189 | $embed = $field->getValidationInput([$field->column() => $availInput[$k][$c]]); |
|
190 | ||
191 | return $embed ? $array_key_attach_str($embed, $v) : [null => 'null']; |
|
192 | }, $newColumn); |
|
193 | $newInputs = $array_clean_merge($newInputs, array_filter($newInput, 'strlen', ARRAY_FILTER_USE_KEY)); |
|
194 | ||
195 | $newMessages = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
196 | list($r, $k, $c) = explode('.', $v); |
|
197 | $v = "{$r}.{$k}"; |
|
198 | $embed = $field->getValidationMessages([$field->column() => $availInput[$k][$c]]); |
|
199 | ||
200 | return $embed ? $array_key_attach_str($embed, $v) : null; |
|
@@ 195-208 (lines=14) @@ | ||
192 | }, $newColumn); |
|
193 | $newInputs = $array_clean_merge($newInputs, array_filter($newInput, 'strlen', ARRAY_FILTER_USE_KEY)); |
|
194 | ||
195 | $newMessages = array_map(function ($v) use ($availInput, $field, $array_key_attach_str) { |
|
196 | list($r, $k, $c) = explode('.', $v); |
|
197 | $v = "{$r}.{$k}"; |
|
198 | $embed = $field->getValidationMessages([$field->column() => $availInput[$k][$c]]); |
|
199 | ||
200 | return $embed ? $array_key_attach_str($embed, $v) : null; |
|
201 | }, $newColumn); |
|
202 | $messages = $array_clean_merge($messages, array_filter($newMessages)); |
|
203 | } else { |
|
204 | $fieldRules = is_array($fieldRules) ? implode('|', $fieldRules) : $fieldRules; |
|
205 | $newRules = array_map(function ($v) use ($fieldRules, $availInput, $array_key_attach_str) { |
|
206 | list($r, $k, $c) = explode('.', $v); |
|
207 | //Fix ResetInput Function! A Headache Implementation! |
|
208 | $col = explode(':', $c)[0]; |
|
209 | if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) { |
|
210 | return $array_key_attach_str(preg_replace('/.+/', $fieldRules, $availInput[$k][$col]), $v, ':'); |
|
211 | } |