I’m curious if anyone has a way to produce an entity bundle class for several bundles at once. For example:
function myModule_entity_bundle_info_alter(&$bundles) { // My array of different content types. $target_bundles = ['page', 'article']; // Iterate over the content types. foreach($target_bundle as $bundle) { $Bundle = ucfirst($bundle); // page to Page $bundles['node'][$bundle]['class'] = $bundle::class; // Page::class } }
The problem I’m running into is the $bundle::class
part doesn’t work. Is this possible?
Thanks.