Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Use template method #4

Merged
merged 2 commits into from
Aug 26, 2022
Merged

Use template method #4

merged 2 commits into from
Aug 26, 2022

Conversation

jasonvarga
Copy link
Contributor

@jasonvarga jasonvarga commented Feb 18, 2022

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 statamic/cms#5302 for Statamic 3.3, I went looking on GitHub for usages of augmentValue() and noticed this.

  1. On Statamic 3.2, if you had a field in your blueprint named template, $this->augmentedValue('template') would have been a Value instance, so this condition would always be false.
  2. On Statamic 3.3, even if you don't have a field named template, $this->augmentedValue('template') will be a Value instance, again making this condition always false.
  3. You can just use the template() method to get the plain template name.
  4. I swapped the instanceof check to first, so you can be sure the template() method will be available to use since you'll know it's a Page or Entry already.

@hotmeteor hotmeteor merged commit 44dc5e7 into hotmeteor:main Aug 26, 2022
@jasonvarga jasonvarga deleted the patch-1 branch August 26, 2022 14:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants