Warning using component in webform

Created on 3 July 2024, 6 months ago
Updated 17 July 2024, 5 months ago

Problem/Motivation

When using the Rut component in Webform and not specifying a 'message_js', warnings appear.

Warnings:

Warning: Undefined array key "#message_js" en Drupal\rut\Element\RutField::processRutElementForm() (línea 66 de /var/www/html/web/modules/contrib/rut/src/Element/RutField.php)

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated en Drupal\rut\Element\RutField::processRutElementForm() (línea 66 de /var/www/html/web/modules/contrib/rut/src/Element/RutField.php)

Proposed resolution

Ajust line
$message = trim($element['#message_js']) != '' ? $element['#message_js'] : t('Invalid Rut');
to
$message = isset($element['#message_js']) && trim($element['#message_js']) != '' ? trim($element['#message_js']) : t('Invalid Rut');

🐛 Bug report
Status

Fixed

Version

1.10

Component

Code

Created by

🇨🇱Chile Aneida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024