protected static function ExtensionLoader::loadAll in Unified Twig Extensions 1.0.x
Loads all plugins of a given type.
This should be called once per $type.
Parameters
string $type: The type to load all plugins for.
1 call to ExtensionLoader::loadAll()
- ExtensionLoader::init in src/
TwigExtension/ ExtensionLoader.php - Loads a singleton registry of plugin objects.
File
- src/
TwigExtension/ ExtensionLoader.php, line 50
Class
- ExtensionLoader
- Loads twig customizations from a dist directory.
Namespace
Drupal\unified_twig_ext\TwigExtensionCode
protected static function loadAll($type) {
$theme = \Drupal::config('system.theme')
->get('default');
$themeLocation = drupal_get_path('theme', $theme);
$themePath = DRUPAL_ROOT . '/' . $themeLocation . '/';
$extensionPaths = glob($themePath . '*/_twig-components/');
foreach ($extensionPaths as $extensionPath) {
$fullPath = $extensionPath;
foreach (scandir($fullPath . $type) as $file) {
$fileInfo = pathinfo($file);
if ($fileInfo['extension'] === 'php') {
if ($file[0] != '.' && $file[0] != '_' && substr($file, 0, 3) != 'pl_') {
static::load($type, $fullPath . $type . '/' . $file);
}
}
}
}
}