<p>The <code>entry</code> variable is an instance of <a href="https://docs.craftcms.com/api/v3/craft-elements-entry.html" rel="nofollow noreferrer"><code>craft\elements\Entry</code></a>. Most of the attributes you are going to be interested in are either properties of the class or customf fields.</p>
<h2>Class properties</h2>
<p>All entries have properties like a the <code>title</code>, <code>id</code>, <code>postDate</code>, <code>slug</code>, <code>authorId</code>, etc. You can find them in the <a href="https://docs.craftcms.com/api/v3/craft-elements-entry.html" rel="nofollow noreferrer">class reference for the Entry class</a>. Check out the <a href="https://docs.craftcms.com/api/v3/craft-base-element.html" rel="nofollow noreferrer">base Element class</a> as well – all element types (entries, categories, assets, etc) inherit from it.</p>
<h2>Custom fields</h2>
<p>Custom fields are the fields you have defined in your Craft installation and added to the entry's <a href="https://craftcms.com/docs/3.x/entries.html#entry-types" rel="nofollow noreferrer">Entry type</a>. You can check the entry type in Settings -&gt; Sections -&gt; [Name of the section] -&gt; Tab &quot;Entry Types&quot; -&gt; [Name of the Entry type].</p>
<p>If you're not sure which section or entry type your entry has, you can find out like this:</p>
<pre class="lang-twig prettyprint-override"><code>{% dd [entry.section.name, entry.type.name] %}
</code></pre>
<p>You can also display field handles in the entry edit form. Go to your account preferences and check the option *Show field handles in edit forms *. Then go to edit the entry – the field handles will be displayed in the upper right of each field.</p>
<p>Finally, here's a handy oneliner to get an array of custom field handles for an entry:</p>
<pre class="lang-twig prettyprint-override"><code>{% dd entry.getFieldLayout().getFields()|column('handle') %}
</code></pre>
<p>Further reading: <a href="https://craftcms.stackexchange.com/a/37760/11705">How to check for available fields for an entry</a></p>

CC BY-SA 4.0
2021-11-11T11:18:55.880Z
2021-11-11T11:18:55.880Z
MoritzLost
<p>I have a craft project which I've inherited and I'm trying to make some minor changes. I don't know PHP, Craft, or Twig very well so forgive me if this is an <a href="https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">XY problem</a>. This website is a company website and has pages for projects, jobs, case studies etc.</p>
<p>Basically, I have something called an <code>entry</code> in the templates and this has attributes like <code>.title</code>, <code>.offerings</code> etc. This <em>entry</em> is a project and if I view the text in the admin interface, I can see some fields there. There are parts of the code that look like this</p>
<pre><code>  {% set projectDescription = entry.title%}
</code></pre>
<p>My question is, how do I know what are the attributes that <code>entry</code> has so that I can pull it out and display it?</p>
<p>Thanks!</p>

<templating>
Find attributes in an object
# Find attributes in an object

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

I have a craft project which I've inherited and I'm trying to make some minor changes. I don't know PHP, Craft, or Twig very well so forgive me if this is an XY problem. This website is a company website and has pages for projects, jobs, case studies etc.
Basically, I have something called an entry in the templates and this has attributes like .title, .offerings etc. This entry is a project and if I view the text in the admin interface, I can see some fields there. There are parts of the code that look like this
  {% set projectDescription = entry.title%}

My question is, how do I know what are the attributes that entry has so that I can pull it out and display it?
Thanks!

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2021-11-11. Score: 3

The entry variable is an instance of craft\elements\Entry. Most of the attributes you are going to be interested in are either properties of the class or customf fields.
Class properties
All entries have properties like a the title, id, postDate, slug, authorId, etc. You can find them in the class reference for the Entry class. Check out the base Element class as well – all element types (entries, categories, assets, etc) inherit from it.
Custom fields
Custom fields are the fields you have defined in your Craft installation and added to the entry's Entry type. You can check the entry type in Settings -> Sections -> [Name of the section] -> Tab "Entry Types" -> [Name of the Entry type].
If you're not sure which section or entry type your entry has, you can find out like this:
{% dd [entry.section.name, entry.type.name] %}

You can also display field handles in the entry edit form. Go to your account preferences and check the option *Show field handles in edit forms *. Then go to edit the entry – the field handles will be displayed in the upper right of each field.
Finally, here's a handy oneliner to get an array of custom field handles for an entry:
{% dd entry.getFieldLayout().getFields()|column('handle') %}

Further reading: How to check for available fields for an entry


---

