protected function getLayout(string $layout = null): string
    {
        if ($layout === null) {
            $frontendBridgeComponentExists = isset($this->FrontendBridge);
            $layout = 'FrontendBridge.json_action';

            if ($frontendBridgeComponentExists) {
                $layout = $this->FrontendBridge->config('templatePaths.jsonAction');
            }

            if ($this->request->is('dialog')) {
                $layout = 'FrontendBridge.dialog_action';

                if ($frontendBridgeComponentExists) {
                    $layout = $this->FrontendBridge->config('templatePaths.dialogAction');
                }
            }
        }

        return $layout;
    }