private function buildConfig(Request $request)
    {
        $editor = $this->getEditor();

        $config = $editor->getConfig();
        unset($config['layout']);

        $locales = [];
        foreach ($config['locales'] as $locale) {
            $locales[] = [
                'name'  => $locale,
                'value' => $locale,
                'title' => ucfirst(Intl::getLocaleBundle()->getLocaleName($locale)),
            ];
        }
        $config['locales'] = $locales;

        $config['hostname'] = $request->getHost();
        if (!empty($path = $request->query->get('path'))) {
            $config['path'] = $path;
        } else {
            $config['path'] = $this->generateUrl($this->getParameter('ekyna_cms.home_route'));
        }
        $config['plugins'] = $editor->getPluginsConfig();

        return $config;
    }