- Issue created by @eduardo morales alberti
- @eduardo-morales-alberti opened merge request.
- Status changed to Needs review
almost 2 years ago 10:15am 24 March 2023
When the title is not set the word field is duplicated on the CvValidatorBase
protected function getElementTitle(array $element, $default = '') {
$title = $this->getAttributeValue($element, 'title');
if (empty($title) && empty($default)) {
return $this->t('This field');
}
return $title ? $title : $default;
}
// Drupal already adds the required attribute, so we don't need to set the
// required rule.
if ($is_required || $is_conditionally_required) {
$message = $element['#required_error'] ??
$this->t('@title field is required.', [
'@title' => $this->getElementTitle($element),
]);
return [
'messages' => [
'required' => $message,
],
];
}
The result will be something like:
Change "This field", to "This", I am not sure if there is a better text for it.
Needs review
4.0
Form Validation