Pimcore guides &amp; How to 2 min read

# Pimcore twig editables – Tips &amp; Tricks

You're looking to clean up your code? Find out more about Pimcore editables and use them to make your code cleaner and easier to read!

Last updated on 29 August, 2025

## Key takeaways

1. Storing a Pimcore editable in a Twig variable before rendering it makes template code shorter, cleaner and easier for other developers to read.
2. Keeping an editable in a variable lets you use its value, such as a checkbox state, before the editable itself is rendered on the page.
3. An editable stored in a variable is rendered later in the template with Twig's raw filter, exactly where it should appear.

## **What you’ll learn with this guide**

This guide will show you how to define and set Pimcore editables before rendering them to make your code cleaner and easier to read, understand and add to.

## **Where to use**

Writing clean code is an overall great practice because it makes the further development process easier for developers that come after us. Because of that, it is desirable to do it wherever we can.
Also, this method can be used in use cases where we need to, like in the following example, use the value of an editable before it is rendered.

## **Solution**

Editables are the essential part of managing content in documents so there will be a lot of them in your code. To make it easier for you and other developers to manage your code, you can shorten it and make it more readable. To understand this, let’s get to the example.

By following Pimcores documentation we learn to use editables like this:

In this example, it is important to instantiate the editable before using it like this:

So after this, we can use our variable which depends on the editable:

This is the standard way, but in this guide we will show you how to store the editable in a variable so you don’t need to render it until you really need it.

First we store the editable in a variable like this:

By doing this, we can use it before it is rendered:

In the end, we render the editable via “raw” filter where we want to use it:

This way, if you need the value of the checkbox before it is rendered, you can use it unlike in the first method. This makes the programming process easier so it’s very useful.

## **Does it work?**

Because this guide is pretty straightforward, you can test it by trying it out.

## **If you’d like some help with Pimcore, feel free to say hello@factory.dev!**

## Related

[Pimcore guides &amp; How to **Pimcore Studio Setup Guide: Backend &amp; Infrastructure for Developers** Step-by-step overview of Pimcore Studio backend setup, including required services, DDEV configuration, bundle installation, indexing, and production considerations. 34 min read](https://factory.dev/pimcore-knowledge-base/tutorial/pimcore-studio-setup-guide-backend-infrastructure) [Pimcore guides &amp; How to **Customizing Pimcore Classification Store: Removing Grid View Duplicates and Simplifying DataHub Imports** Shared Classification Store attributes can clutter Pimcore grid views and make DataHub imports harder to maintain. This article shows how a custom implementation creates one logical attribute view… 10 min read](https://factory.dev/pimcore-knowledge-base/how-to/customizing-pimcore-classification-store) [Pimcore guides &amp; How to **Using named API routes in separated Vue CLI generated Applications** Discover how to use named, and exposed routes via Symfony FOSJsRoutingBundle in separated Vue CLI generated Applications. 2 min read](https://factory.dev/pimcore-knowledge-base/how-to/named-api-routes-in-separated-vue-cli-generated-applications)

---

Source: https://factory.dev/pimcore-knowledge-base/how-to/pimcore-twig-editables-tips-tricks
