8000 fixes input "content" validation · laravel-enso/forms@c2ba968 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2ba968

Browse files
committed
fixes input "content" validation
1 parent 6478b52 commit c2ba968

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/Exceptions/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ public static function invalidFieldType($type)
162162
));
163163
}
164164

165-
public static function missingInputAttribute($field)
165+
public static function missingInputContent($field)
166166
{
167167
return new static(__(
168-
'Mandatory "type" meta parameter is missing for the :field input field',
168+
'Mandatory "content" meta parameter is missing for the :field input field',
169169
['field' => $field]
170170
));
171171
}

src/Services/Validators/Meta.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ private function mandatoryAttributes(): self
3838

3939
if ($diff->isNotEmpty()) {
4040
throw Template::missingMetaAttributes(
41-
$this->field->get('name'), $diff->implode('", "')
41+
$this->field->get('name'),
42+
$diff->implode('", "')
4243
);
4344
}
4445

@@ -55,7 +56,8 @@ private function optionalAttributes(): self
5556

5657
if ($diff->isNotEmpty()) {
5758
throw Template::unknownMetaAttributes(
58-
$this->field->get('name'), $diff->implode('", "')
59+
$this->field->get('name'),
60+
$diff->implode('", "')
5961
);
6062
}
6163

@@ -65,8 +67,8 @@ private function optionalAttributes(): self
6567
private function format(): self
6668
{
6769
if ($this->meta->get('type') === 'input') {
68-
if ($this->inputMetaParameterMissing($this->field)) {
69-
throw Template::missingInputAttribute($this->field->geT('name'));
70+
if (! $this->meta->has('content')) {
71+
throw Template::missingInputContent($this->field->get('name'));
7072
}
7173

7274
return $this;
@@ -92,11 +94,6 @@ private function type(): void
9294
}
9395
}
9496

95-
private function inputMetaParameterMissing(): bool
96-
{
97-
return $this->meta === null || ! $this->meta->has('content');
98-
}
99-
10097
private function selectMetaParameterMissing(): bool
10198
{
10299
return $this->meta === null

0 commit comments

Comments
 (0)
0