Button Field
A whole button in one field: not just a caption, but everything needed to render a link. Clicking it in the form opens a window with its settings.
What a button holds: caption, type (button, submit, reset, download), link or a resource to link to, a file for the download type, CSS classes, arbitrary attributes, and the flags open in a new window, disabled and published.
The value is stored as JSON, so decode it before use:
html
{set $btn = $cta|json_decode:true}
<a href="{$btn.href}"
class="{$btn.classes}"
{if $btn.target_blank}target="_blank"{/if}>{$btn.caption}</a>A resource instead of a link survives a move
Pointing at a resource rather than typing a URL means the address is resolved by MODX. Move the page or change its alias, and the button follows — a hand-typed link does not.