<p>The template will be rendered with an <code>element</code> 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:</p>
<p><a href="https://i.sstatic.net/HJc3M.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HJc3M.png" alt="Screenshot of the UI element &quot;template&quot; settings" /></a></p>
<p>In general, here's useful debugging method to find out what variables are available in a given template:</p>
<pre class="lang-twig prettyprint-override"><code>{% dd _context | keys %}
</code></pre>
<p>The <code>_context</code> variable contains all variables available in the current scope. Dumping the entire <code>_context</code> is quite unwieldy, so you can use the <code>keys</code> filter to only show the variable names.</p>

CC BY-SA 4.0
2021-11-09T16:54:00.290Z
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 !
Sylvain Tremblay
CC BY-SA 4.0
2021-11-09T16:45:51.527Z
2021-11-09T16:45:51.527Z
MoritzLost
<p>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.
<a href="https://i.sstatic.net/Kkhg3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Kkhg3.png" alt="enter image description here" /></a></p>

<templating><control-panel>
Customizing Field Layout / UI element in Craft Control Panel
# Customizing Field Layout / UI element in Craft Control Panel

(Asked by: username_0 on 2021-11-09)

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](https://i.sstatic.net/Kkhg3.png)](https://i.sstatic.net/Kkhg3.png)

**Tags:** templating, control-panel


---

## 1 answers

### Answer by username_1 on 2021-11-09. Score: 1 | Accepted answer

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:

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.

> **Comments:**
> **username_0**: Thanks a lot @username_1 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 !  

---

