I have a requirement to add a unique icon to each bundle of an entity. My entity code is very similar to the model module. I have 2 entities, one for holding the actual entity instances, another for holding the type information.

Each entity type will have a unique icon which will be shown while adding that entity in the creation form. For this, I need to add a custom property to the entity which will hold the image file data.

1 Answer 1


You need to create an integer property that references the fid column in the file_managed table.

For inspiration, check out the user_account_form() function (the picture element) and associated validate/submit handlers. They show the exact methodology you need to use.

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.