public function get_metadata_for_components() : array {
        // Get the metadata, and put into an assoc array indexed by component name.
        $metadata = [];
        foreach ($this->get_component_list() as $component) {
            $componentmetadata = $this->handled_component_class_callback($component, metadata_provider::class,
                'get_metadata', [new collection($component)]);
            if ($componentmetadata !== null) {
                $metadata[$component] = $componentmetadata;
            }
        }
        return $metadata;
    }