function thunder_fia_theme in Thunder 8.2
Same name and namespace in other branches
- 8.3 modules/thunder_article/modules/thunder_fia/thunder_fia.module \thunder_fia_theme()
Implements hook_theme().
File
- modules/
thunder_article/ modules/ thunder_fia/ thunder_fia.module, line 15 - Thunder Article module hooks.
Code
function thunder_fia_theme($existing, $type, $render, $path) {
$theme = [];
$files = scandir(DRUPAL_ROOT . '/' . $path . '/templates');
foreach ($files as $file) {
if ($file === '.' || $file === '..') {
continue;
}
$file = str_replace('-', '_', $file);
$file = basename($file, '.html.twig');
$base = [];
preg_match('/([a-z]*)_/', $file, $base);
$theme[$file] = [
'path' => $path . '/templates',
'base hook' => $base[1],
];
}
return $theme;
}