protected function generateRenderOptions(array &$options)
    {
        $i18n = $this->controller->getService('i18n');
        $defaultLocales = $i18n->fallbacks();
        array_unshift($defaultLocales, $i18n->defaultLocale());
        
        $format = $this->controller->request() ?
            $this->controller->request()->format() :
            null;
        
        if (isset($options['details'])) {
            $details = $options['details'];
        } else {
            $details = [];
        }
        
        if (!isset($details['formats'])) {
            $details['formats'] = [];
        }
        if ($format) {
            $details['formats'][] = $format;
        }
        
        if (!isset($details['handlers'])) {
            $details['handlers'] = [];
        }
        $details['handlers'] = array_merge(
            array_keys($this->actionView()->handlers()),
            $details['handlers']
        );
        
        if (!isset($details['locale'])) {
            $details['locale'] = [];
        }
        $details['locale'] = array_merge($defaultLocales, $details['locale']);
        
        $options['details'] = $details;
        
        $layout = $this->controller->layout();
        if ($layout === null) {
            $options['layout'] = 'application';
        } elseif (is_string($layout)) {
            $options['layout'] = $layout;
        }
    }