/** * @implement theme * @return array */ public static function load() { $themes = []; static::$container = Drupal::getContainer(); foreach (static::getFiles('/^.+\\.themes\\.yml/i') as $file) { $path = dirname($file); $info = static::yamlDecode($file); foreach ($info['themes'] ?? [] as $name => $theme) { if (!isset($theme['variables'])) { $theme['render element'] = $theme['render element'] ?? 'scope'; } $theme['path'] = $path . '/' . ($theme['path'] ?? 'templates'); $theme['template'] = $theme['template'] ?? $name; $theme += ['pattern' => FALSE, 'preprocess functions' => [], 'override preprocess functions' => TRUE]; foreach ($theme['preprocess functions'] as $k => $function) { $theme['preprocess functions'][$k] = Submodules::generateCallbackName($function); } $themes[$name] = $theme; } } return $themes; }