inertia-statamic
inertia-statamic copied to clipboard
Use template method
Disclaimer - I did this all in the GitHub editor. I didn't actually test it, so you'll probably want to check it out.
While I was doing https://github.com/statamic/cms/pull/5302 for Statamic 3.3, I went looking on GitHub for usages of augmentValue()
and noticed this.
- On Statamic 3.2, if you had a field in your blueprint named
template
,$this->augmentedValue('template')
would have been aValue
instance, so this condition would always befalse
. - On Statamic 3.3, even if you don't have a field named
template
,$this->augmentedValue('template')
will be aValue
instance, again making this condition alwaysfalse
. - You can just use the
template()
method to get the plain template name. - I swapped the
instanceof
check to first, so you can be sure thetemplate()
method will be available to use since you'll know it's aPage
orEntry
already.