protected function getPluginTypes($pattern, $plugin_path)
    {
        $types = [];
        $project_root = ProjectX::projectRoot();

        foreach ($this->getInstalledPluginNamespaces() as $name => $namespace) {
            $plugin_dir = "$project_root/vendor/$name";

            if (!file_exists($plugin_dir)) {
                continue;
            }
            $plugin_dir = "$plugin_dir/src";

            if (isset($plugin_path)) {
                $plugin_dir = "$plugin_dir/$plugin_path";
            }

            if (!file_exists($plugin_dir)) {
                continue;
            }

            $classes = (new PhpClassDiscovery)
                ->setSearchPattern($pattern)
                ->addSearchLocation($plugin_dir)
                ->discover();

            foreach ($classes as $classname) {
                if (!class_exists($classname)) {
                    continue;
                }

                $types[$classname::getTypeId()] = $classname;
            }
        }

        return $types;
    }