1

I'm using a contributed module that provides a custom entity. I would like to modify that entity and want to enable comments for this entity.

Does anybody know how to enable commens for custom entities?

2
  • an 'entity' can mean nearly anything - are you referring to a node? a content type? a field?
    – Geoff
    Jun 15, 2015 at 16:32
  • It's not a node and not a content type. It is a custom entity. You can create own custom entities by implementing hook_entity_info() (see Creating your own entities with Entity API for more details)
    – sgoelz
    Jun 16, 2015 at 7:04

2 Answers 2

2

For Drupal 7, this module should do it - https://www.drupal.org/project/comments_entity

For Drupal 8, comments are available as a field for any entity type.

Summary:

  1. Create a new Entity Type
  2. Create a new Bundle for that Entity Type
  3. Create a new Comment Type and select your Entity Type
  4. "Manage Fields" on your new Bundle and add a new "Comments" field.
  5. Configure comments as desired in the field settings.

Wrote a blog post about it here: http://www.daggerhart.com/drupal-8-add-comments-custom-entity-type/

2
0

It's not possible to enable comments for custom entities because the structure of comments is made to comment nodes and not entities.

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.