Skip to content

Commit

Permalink
GetDKAN#4159: Increase textfields maxlength - better place for inject…
Browse files Browse the repository at this point in the history
…ing maxlength
  • Loading branch information
stefan-korn committed Apr 25, 2024
1 parent bd4c018 commit 576ea1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions modules/json_form_widget/src/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public function handleStringElement($definition, $data, $object_schema = FALSE)
$element = [
'#type' => $this->getElementType($property),
];
if ($element['#type'] === 'textfield') {
$element['#maxlength'] = 256;
}
$element['#title'] = $property->title ?? '';
$element['#description'] = $property->description ?? '';
$element['#description_display'] = 'before';
Expand Down
3 changes: 3 additions & 0 deletions modules/json_form_widget/src/WidgetRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public function getConfiguredWidget($spec, array $element) {
$method_name = $widgets[$spec->widget];
$element = $this->$method_name($spec, $element);
}
if ($element['#type'] === 'textfield' && empty($element['#maxlength'])) {
$element['#maxlength'] = 256;
}
return $element;
}

Expand Down

0 comments on commit 576ea1e

Please sign in to comment.