This is an attempt to think about ways to generalize this request: #1960908: Entity API integration.

We currently have one generator that's the way in to making module code: ModuleBuilderGeneratorModule.

However, there is no reason why we can't have other entry generators.

So, I can imagine an 'entity type' generator which would:

- explicitly set the hooks it provides, ie, not need a list of hooks in its input
- accept other parameters for things like entity name and so on

The first part is easy. The second, less so. We'd either need some clever way to parse the api.php sample code (which doesn't sound easy at all), or we'd need to provide our own template for the hooks where we'll need to perform replacements on code.

This could potentially take over the current hook group/preset system (both names are in use in our code!).

We'd have:

- a parent class, which contains all the logic
- child classes for each preset, which merely define the list of hooks that preset needs.
- the existing hook template system can still be used: after all, having your hook_entity_info() say '%entity_type' instead of 'node' in your generated code is helpful too.
- some sort of UI

Comments

joachim’s picture

Issue summary: View changes

UI

joachim’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This made it into Drupal Code Builder some time ago.