Closed aaronrobb closed 1 year ago
Hmmmm, sounds like a PHP8/types gotcha. I'll check it out.
Ran into the same issue. Modifying TypographyService.php and changing the function declaration for typogrify from
public function typogrify(string $text, array $adhocSettings = []): string
to public function typogrify(string|null $text, array $adhocSettings = []): string
looks to resolve the issue.
Fixed in 4.1.0. Thanks!
I'm getting this error after a Craft 4 upgrade:
TopShelfCraft\Wordsmith\services\TypographyService::typogrify(): Argument #1 ($text) must be of type string, null given, called in /vendor/topshelfcraft/wordsmith/src/services/WordsmithService.php on line 1117
This is on a line of code like:
{{ item.title|typogrify }}
which worked on Craft 3.
Now the obvious issue is that on this specific page the tag is coming back null, but in Craft 3 that wasn't an issue.
When I add something like:
{{ item.title ?? "" |typogrify }}
it allows the page to load, but then for some reason if the text field had code in it, like a
<br>
tag, it shows the code.I can wrap the whole tag in an 'IF' statement, but there has to be a shorter way, like above, but without the code showing.
Is this a known issue, or am I missing something?