Posts tagged: drupal-entities

Drupal Entities – PHP Class per bundle

If you would like a bit more polymorphism in your drupal entities, this might cheer you up 😀

I was looking for a way to have a class hierarchy that matched the bundle “hierarchy” of entities in drupal. Yes, they are all “subclasses” of ONE parent, but it is still useful to be able to have a class per bundle.

The entity bundle plugin does a good job of providing a plugin framework to instantiate classes per bundle type. There is also an example of how to use this. However, this was a bit of overkill for me. I did however borrow the idea (and some code) to implement it in a simpler fashion.

Read more »

WordPress Themes