Pimcore guides & How to 2 min read
How to create a custom editable in Pimcore
Pimcore does offer a large number of editables from the very start. But specific requirements call for specific new custom editables. Learn how to create them!

What you’ll learn with this guide
Pimcore editables are a powerful tool that allows users to easily customize the content of Pimcore documents.
There are a lot of built-in editables that come with Pimcore upon installation, but the great thing about Pimcore is that it gives us an easy way to add new editables if we need them.
This guide will go through the process of creating a custom editable. As an example, we will create a color picker editable that can later be used to define the color of other editables or content.
Where to use custom editables?
Even though Pimcore offers a lot of editables, clients always have specific requirements and sometimes you will need to define a custom editable to match these requirements.
Solution
To create a custom editable we need to follow a couple of steps.
First, we need to create a PHP editable class. The most important thing here is that our class needs to extend the class.
By extending this class, we will be forced to implement some methods (methods are explained inside of the code example).
Let’s create our PHP class (according to Pimcore, the best practice is to put that class in ).
After the PHP class is created we have to register it as an editable inside of the config.yaml file.
The next step would be to create a javascript file that will handle editable inside editmode.
Let’s create a colorPicker.js file inside the . First, we need to define a namespace for editable and make sure to use type defined in yaml and PHP. Then we can create a new editable by extending or by extending any existing editable (e.g. ). When extending existing editable it’s only necessary to define the getType method and return the type we used in PHP.
When creating new editables, we also have to define other methods that are shown and explained in the code example below.
After the javascript file is defined, we need to import it in admin by defining a Pimcore admin listener and registering it in services.yaml
Does it work?
If you follow this guide closely, you should be able to add a new color picker editable to your documents by using this code inside a twig template.
The end result will be something like this.

Do you have more questions or you’re having issues while implementing this? Reach out to us; we’ll be glad to help!
Related
Pimcore guides & How to Pimcore Studio Setup Guide: Backend & 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
Pimcore guides & 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
Pimcore guides & 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
