Margaret Thatcher, Ronald McDonald, David Bowie, Zendaya, Vanessa down the street. What do these people (does Ronnie count as a person?) have in common? Hell if I know.
I wrote a Statamic 3 addon that I’ve been copying and pasting into every Statamic project I work on. It’s basically Laravel’s Arr::get() helper in Antlers. I used something similar in v2 back when Jim-Jam and I cranked out Statamic builds left and right and I more actively battled my nemesis.
![Left: Jim-Jamm, wearing a hat and looking off into the distance. Right: My nemesis, with a devilish grin and horns scribbled on](https://cdn.prod.website-files.com/647a639928e918e69c9b59b6/65205e68de7ac7ff7f9607bf_laravel-s-array-get-for-statamic-65205958f1c8e.webp)
It helps me:
- Streamline my markup
- Easily add new variants (especially easy for minor differences like colors, sizes, padding… all that jazz 🎷) (doubly-especially wonderful with Tailwind)
- Allow content authors to oh-so-simply choose which variant to render
- And probably some other stuff not coming to mind right now 🤔
Anyway, check it out on GitHub, Packagist, and the Statamic Marketplace. Let me know if you come up with more interesting use cases or if you run into any problems!
![Array Get addon code with Highland's logo in the lower right corner.](https://cdn.prod.website-files.com/647a639928e918e69c9b59b6/65205eb6f679fee7c4ee7ee6_code-6520595e6ce53.webp)
Addon in the Statamic Marketplace. Oh, yes. One other neat thing I didn’t document because it’s more of a side effect than an intentional feature: Array Get allows you to throw Antlers code in your front-matter and have it parsed in the output. I did that all the time in v2 (and probably v1?), but (last time I checked) v3 doesn’t support Antlers in your front-matter.