These errors occur when rendering elements of the type "file_upload_help" :

Notice: Undefined index: #title in Drupal\webform\Plugin\WebformElementBase->getLabel() (line 1034 of .../webform/src/Plugin/WebformElementBase.php).

Notice: Undefined index: #webform_key in Drupal\webform\Plugin\WebformElementBase->getLabel() (line 1034 of .../webform/src/Plugin/WebformElementBase.php).

Comments

wouterdierick created an issue. See original summary.

wouter.dierick@gmail.com’s picture

Patch attached

jrockowitz’s picture

Status: Active » Needs work

@wouterdierick I would like to figure out how you were able to create a file upload element without a #title. The #title even when it is not visible is used to improve accessibility.

Did you create the element via editing the YAML?

I think you can just change...

return $element['#title'] ?: $element['#webform_key'];

...to...

return (!empty($element['#title'])) ? $element['#title'] : $element['#webform_key'];

Can you please update the patch.

tim-diels’s picture

A file upload field seems to behave a bit different then the other fields. It doesn't have $element['#title'] or $element['#webform_key'] in the function that calls for the label => displayDisabledWarning()
So changing the patch wouldn't solve the issue nor does the first patch solves the issue but makes the notices go away.

The actual error is: '' is a 'Generic element' element, which has been disabled and will not be rendered.

But managed_file is enabled and the field is rendered.

vakulrai’s picture

Status: Needs work » Needs review
StatusFileSize
new533 bytes

I am also able to crate a webform field without a title.
uploading a patch for above issue.

  • jrockowitz committed bc24fba on 8.x-5.x authored by vakulrai
    Issue #2968002 by wouterdierick, vakulrai: Undefined indexes when...
jrockowitz’s picture

Status: Needs review » Fixed

Thanks for the patch.

jrockowitz’s picture

@tim-diels I think you might need to create a new ticket in the issue queue for #4

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.