1

Maybe I don't understand well the usage of UI Element in Field Layout, but I would like to display something more 'jazzy' for the admin on his CP and I thought inserting a twig template in the page would be nice. But within the twig, I don't see how I could get the field data of the actual entry on page. I don't find any documentation on this feature and how to use it. Can you shed lights on this please ? Say here I want to use those value in twig. enter image description here

1 Answer 1

1

The template will be rendered with an element variable which you can use to display fields and other properties of the given element. See the info displayed in the settings once you add it to the field layout:

Screenshot of the UI element "template" settings

In general, here's useful debugging method to find out what variables are available in a given template:

{% dd _context | keys %}

The _context variable contains all variables available in the current scope. Dumping the entire _context is quite unwieldy, so you can use the keys filter to only show the variable names.

1
  • 1
    Thanks a lot @MoritzLost that's all I needed ! So it all start with _context variable, it's good to know ! Thanks again, I can going on from this ! Nov 9, 2021 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.