modxcms / fred

The friendly front-end editor for visual, drag-and-drop content building in MODX CMS
https://fred.modx.com
MIT License
57 stars 25 forks source link

Feature Suggestion: Access to on-canvas field values via twig. #477

Open Jsewill opened 1 year ago

Jsewill commented 1 year ago

It would be very nice to have access to the value of a named element via twig. An example use case:

<figure>
    <img src="..." alt="{{ img_caption }}" ... />
    <figcaption data-fred-name="img_caption">Caption text goes here.</figcaption>
</figure>

Where the above is the source of an element; the caption should be editable on-canvas, rather than in an option. Currently, these sorts of values are inaccessible. It would be wonderful to have access to them, as you can see in this example. Otherwise, we must resort to using options, which defeats the purpose of Fred. (Not that options are bad, they're great). There are plenty more use cases where it would be beneficial to have access to on-canvas values via twig.

A simple improvement like this would go a long way toward bringing Fred closer to traditional modx style templating--an attribute for which web shops have long preferred modx. modx has been such a great tool over the years, especially as it relates to templating and such. I want to see modx catch up to, and surpass, other CMS/CMF projects in features like this (and in every way). Bringing the front-end editor on par with traditional modx templating would be awesome!