on January 11th, 2019

Statamic has been under renovation
With the goal of delightful simplification
So with much excitification
It's time for us to unveil AUGMENTATION

You know how in Statamic 2 your template data has no awareness of which fieldtype was used to create said data?

In Statamic 3, the data layer is now connected to your Blueprint (Fieldsets have been given an upgrade and will be called Blueprints. More on that in a future post), and wherever necessary, Fieldtypes defined in yur Blueprint that want to modify the stored data will automatically augment() it, transforming it into the desired output.

In other words, each fieldtype (which may optionally factor in its field-specific config settings) has the opportunity to manipulate the data at render time.

An example

Let's use a Markdown fieldtype and main_content field as an example. If you write content in Markdown, you almost definitely want that source text to be transformed into HTML on the front-end of your site.

With augmentation, {{ main_content }} will automatically be rendered with Markdown — no need to remember to use the markdown modifier: {{ main_content | markdown }}.

This opens up a ton of possibilities. For example, relationship fields can be eager loaded automatically, no more need for the Relate tag.

<!-- You can replace this... -->
{{ relate:additional_reading }}
    <a href="{{ url }}">{{ title }}</a>
{{ /relate:additional_reading  }}

<!-- with this. -->
{{ additional_reading }}
    <a href="{{ url }}">{{ title }}</a>
{{ /additional_reading  }}

A hypothetical photo gallery fieldtype addon could automatically render its own markup (as dictacted in the addon somewhere), a YouTube video fieldtype could automatically render the proper embed code markup, and so on. You name it.

Oh and if you're wondering, yes of course you'll still be able to access the unmodified data too, though another var name (or equivalent). We're still working out the best naming convention for that. Naming things is hard.

Jack McDade
Jack McDade, Creator of Statamic
Creator of Statamic

Copyright 2020 Statamic