Problem/Motivation
Visiting the Manage Display page for a content type (/admin/structure/types/manage/[node]/display) causes a fatal error:
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given...
Steps to reproduce
- Enable Display Suite (ds) module.
- Go to /admin/structure/types/manage/[your_content_type]/display.
- If a field has no field template set or the formatter is not recognized, you encounter the error.
- The page crashes with a TypeError.
Proposed resolution
Replace:
$summary[] = 'Field template: ' . Html::escape($field_function);
With:
$summary[] = 'Field template: ' . Html::escape((string) $field_function);
This ensures no fatal error occurs when $field_function is NULL.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3522746-1.patch | 459 bytes | andysipple |
Comments
Comment #2
andysipple commentedSee patch
Comment #4
swentel commentedInteresting although I can't reproduce it at this point, but fair enough to fix it of course :)
I've changed it to use !empty() call instead of casting it to a string.
Thanks for the report!