Compact Modifier
Converts a comma-delimited string of variable names into an array of their values.
It allows colon delimited syntax to target nested variables.
title: 'The finest title there ever was'
stuff:
one: 'Value One'
two: 'Value Two'
{{ "stuff:one, title, stuff:two" | compact | ul }}
{!! Statamic::modify("stuff:one, title, stuff:two")->compact()->ul() !!}
Would produce the following output:
<ul>
<li>Value One</li>
<li>The finest title there ever was</li>
<li>Value Two</li>
</ul>
Hot Tip!
It's similar to PHP's compact() function.
$foo = 'bar';
$baz = 'qux';
compact('foo', 'baz'); // ['foo' => 'bar', 'baz' => 'qux']