Problem/Motivation
The module triggers notices whenever a term/key that should be highlighted has unexpected white spaces.
Notice: Undefined index: term name in Drupal\glossify\GlossifyBase->parseTooltipMatch() (Zeile 104 in PROJECT/html/modules/contrib/glossify/src/GlossifyBase.php)
Examples:
- trailing whitespaces (
term name
) - leading whitespaces (
term name
) - consecutive whitespaces (
term name
)
For term entities, the first to cases should not be expected (term names are trimmed by UI saves, unless created programmatically e.g. on migrations). For the third case, there seems to already be handling in place, however that variable ($term_norm
) is never used.
Proposed resolution
Ignore cases one and two as edge cases triggered by developer fault, as they only happen on custom code/migrations.
Actually make use of $term_norm
to resolve the third case.
Remaining tasks
Review.
Comment | File | Size | Author |
---|---|---|---|
#2 | glossify-fragile_with_whitespaces-2944189-2.patch | 587 bytes | ckaotik |
Comments
Comment #2
ckaotikI've attached a patch that makes use of
$term_norm
.Comment #4
keesje CreditAttribution: keesje commented