protected function getExtraConfig($class, $classConfig, $excludeMiddleware)
    {
        // Note: 'extensions' config needs to come from it's own middleware call in case
        // applied by delta middleware (e.g. Object::add_extension)
        $extensionSourceConfig = Config::inst()->get($class, null, Config::UNINHERITED | $excludeMiddleware | $this->disableFlag);
        if (empty($extensionSourceConfig['extensions'])) {
            return;
        }

        $extensions = $extensionSourceConfig['extensions'];
        foreach ($extensions as $extension) {
            list($extensionClass, $extensionArgs) = ClassInfo::parse_class_spec($extension);
            // Strip service name specifier
            $extensionClass = strtok($extensionClass, '.');
            if (!class_exists($extensionClass)) {
                throw new InvalidArgumentException("$class references nonexistent $extensionClass in 'extensions'");
            }

            // Init extension
            call_user_func(array($extensionClass, 'add_to_class'), $class, $extensionClass, $extensionArgs);

            // Check class hierarchy from root up
            foreach (ClassInfo::ancestry($extensionClass) as $extensionClassParent) {
                // Skip base classes
                switch ($extensionClassParent) {
                    case Extension::class:
                    case DataExtension::class:
                        continue 2;
                    default:
                        // continue
                }
                // Merge config from extension
                $extensionConfig = Config::inst()->get(
                    $extensionClassParent,
                    null,
                    Config::EXCLUDE_EXTRA_SOURCES | Config::UNINHERITED
                );
                if ($extensionConfig) {
                    yield $extensionConfig;
                }
                if (ClassInfo::has_method_from($extensionClassParent, 'get_extra_config', $extensionClassParent)) {
                    $extensionConfig = call_user_func(
                        [ $extensionClassParent, 'get_extra_config' ],
                        $class,
                        $extensionClass,
                        $extensionArgs
                    );
                    if ($extensionConfig) {
                        yield $extensionConfig;
                    }
                }
            }
        }
    }