Shannon Rothe
Shannon Rothe

Reputation: 1122

How does hook_ENTITY_TYPE_create() get invoked?

I've been working with Drupal Console creating custom entity types as well as a custom module which should interface with this entity type. My situation is that I need the hook "hook_ENTITY_TYPE_create()" to be called somehow (I assume it gets called when the entity is created by default).

I guess I must implement this hook in some file, but I'm unsure of which file I should be implementing this hook in.

My module file structure is as follows (generated by Drupal Console)

Drupal Module Structure

Thanks

Upvotes: 1

Views: 529

Answers (1)

acrosman
acrosman

Reputation: 12900

You can put the hook_ENTITY_TYPE_create() in your .module file, but since you noted in your comment that you are trying to react to the saving of the Event entity in your module, you are probably better served by overriding the save() method on the Event entity itself (I believe console gives you a stub method by default).

Upvotes: 1

Related Questions