Dynamic injected value doesn't work after upgrading to 3.3.4 #5762
-
After upgrading from 3.2.37 to 3.3.4, I'm experiencing an error with an injected value. So you know, I didn't opt in to the new Antlers parser. Here's the relevant bit from our collection's config: inject:
title_as_month_day: '{{title insert="2020-|0" format="F j"}}' Entry titles in this collection are in the form of That all worked fine prior to upgrading. But now In case you're curious, the same problem occurs with the new Antlers parser enabled. Is there a solution you're aware of or should I file this as a bug? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I wouldn't have thought you could put Antlers in injected variables like that in the first place. I'm surprised it ever worked. I'd suggest removing that variable and making a tag instead. <?php
namespace App\Tags;
use Carbon\Carbon;
use Statamic\Tags\Tags;
class TitleAsMonthDay extends Tags
{
public function index()
{
$title = '2020-'.$this->context->get('title');
return Carbon::parse($title)->format('F j');
}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks so much, @jasonvarga! I really appreciate it. I was new to creating custom tags, so here are the steps I took to implement Jason's code, for anyone who may land here and find them useful. (Docs page for reference: Building Tags.)
From there, you can use the tag in a template with {{
partial:example_partial
example_date_text="{title_as_month_day}"
}} Thanks, again! |
Beta Was this translation helpful? Give feedback.
I wouldn't have thought you could put Antlers in injected variables like that in the first place. I'm surprised it ever worked.
I'd suggest removing that variable and making a tag instead.