diff --git a/web/modules/custom/custom/custom.module b/web/modules/custom/custom/custom.module index e1181b1..6bb1aa5 100644 --- a/web/modules/custom/custom/custom.module +++ b/web/modules/custom/custom/custom.module @@ -7,24 +7,12 @@ declare(strict_types=1); -use Drupal\discoverable_entity_bundle_classes\Storage\Node\NodeStorage; +use Symfony\Component\Finder\Finder; -/** - * Implements hook_entity_type_build(). - */ -function custom_entity_type_build(array &$entityTypes): void { - /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entityTypes */ - if (isset($entityTypes['node'])) { - $entityTypes['node']->setStorageClass(NodeStorage::class); - } -} +$finder = Finder::create() + ->in(__DIR__ . DIRECTORY_SEPARATOR . 'hooks') + ->name('/.[php|inc]$/'); -/** - * Implements hook_preprocess_HOOK(). - */ -function custom_preprocess_block(array &$variables): void { - // Add the 'markup' class to blocks. - if (in_array($variables['plugin_id'], ['views_block:featured_blog_posts-block_1'])) { - $variables['attributes']['class'][] = 'markup'; - } +foreach ($finder as $file) { + include $file->getPathname(); } diff --git a/web/modules/custom/custom/hooks/entity_type/build.inc b/web/modules/custom/custom/hooks/entity_type/build.inc new file mode 100644 index 0000000..2a74b80 --- /dev/null +++ b/web/modules/custom/custom/hooks/entity_type/build.inc @@ -0,0 +1,20 @@ +setStorageClass(NodeStorage::class); + } +} diff --git a/web/modules/custom/custom/hooks/preprocess/block.inc b/web/modules/custom/custom/hooks/preprocess/block.inc new file mode 100644 index 0000000..e4afdb0 --- /dev/null +++ b/web/modules/custom/custom/hooks/preprocess/block.inc @@ -0,0 +1,18 @@ +