src/Form/View/Helper/SummaryForm.php
public function renderSummaryElement(ElementInterface $element)
    {
        if ($element instanceof Hidden || false === $element->getOption('render_summary')) {
            return '';
        }

        if ($element instanceof EmptySummaryAwareInterface && $element->isSummaryEmpty()) {
            /* @var $element EmptySummaryAwareInterface|ElementInterface */
            $emptySummaryNotice = $this->getTranslator()->translate(
                $element->getEmptySummaryNotice(),
                $this->getTranslatorTextDomain()
            );

            $markup = sprintf(
                '<div id="%s-empty-alert" class="empty-summary-notice alert alert-info"><p>%s</p></div>',
                $element->getAttribute('id'),
                $emptySummaryNotice
            );
            return $markup;
        }

        if ($element instanceof ViewPartialProviderInterface) {
            $renderer    = $this->getView();                 /* @var $renderer \Zend\View\Renderer\PhpRenderer */
            $origPartial = $element->getViewPartial();
            $partial     = "$origPartial.view";
            $partialParams  = array(
                'element' => $element
            );
            if (!$renderer->resolver($partial)) {
                $partial = $origPartial;
                $partialParams['renderSummary'] = true;
            }
    
            return $renderer->partial($partial, $partialParams);
        }
    
        $label  = $this->getTranslator()->translate($element->getLabel());
        $markup = '';
        
        if ($element instanceof FieldsetInterface) {
            if (!$element instanceof FormInterface && $label) {
                $markup .= '<h4>' . $label . '</h4>';
            }
            foreach ($element as $el) {
                $markup .= $this->renderSummaryElement($el);
            }
            return $markup;
        }
    
        $elementValue = $element instanceof \Zend\Form\Element\Textarea
                      ? nl2br($element->getValue())
                      : $element->getValue();

        if ('' != $elementValue && $element instanceof \Core\Form\Element\Select) {
            if ($summaryValue = $element->getOption('summary_value')) {
                $elementValue = is_callable($summaryValue) ? $summaryValue() : $summaryValue;
            } else {
                $options = $element->getValueOptions();
                $translator = $this->getTranslator();
                if (true == $element->getAttribute('multiple')) {
                    $multiOptions = [];
                    foreach ($elementValue as $optionKey) {
                        if (isset($options[$optionKey])) {
                            $multiOptions[] = $translator->translate($options[$optionKey]);
                            continue;
                        }

                        foreach ($options as $optKey => $optVal) {
                            if (!is_array($optVal) || !array_key_exists($optionKey, $optVal['options'])) {
                                continue;
                            }

                            $optGroupLabel = isset($optVal['label']) ? $translator->translate($optVal['label']) : $optKey;
                            $multiOptions[] = $optGroupLabel . ' | ' . $translator->translate($optVal['options'][$optionKey]);
                        }
                    }

                    $elementValue = '<ul><li>' . join('</li><li>', $multiOptions) . '</li></ul>';
                } else {
                    $elementValue = $translator->translate($options[$elementValue]);
                }
            }
        }

        if ('' != $elementValue && $element instanceof \Zend\Form\Element\File) {
            return '';
        }
                      
        $markup .= '<div class="row">';
        $col = 12;
        if ($label) {
            $markup .= '<div class="col-md-3 yk-label"><label>' . $label . '</label></div>';
            $col = 9;
        }
        $markup .= '<div class="col-md-' . $col . '">' . $elementValue . '</div>'
            . '</div>';
        return $markup;
    }
public function renderSummaryElement(ElementInterface $element)
    {
        if ($element instanceof Hidden || false === $element->getOption('render_summary')) {
            return '';
        }

        if ($element instanceof EmptySummaryAwareInterface && $element->isSummaryEmpty()) {
            /* @var $element EmptySummaryAwareInterface|ElementInterface */
            $emptySummaryNotice = $this->getTranslator()->translate(
                $element->getEmptySummaryNotice(),
                $this->getTranslatorTextDomain()
            );

            $markup = sprintf(
                '<div id="%s-empty-alert" class="empty-summary-notice alert alert-info"><p>%s</p></div>',
                $element->getAttribute('id'),
                $emptySummaryNotice
            );
            return $markup;
        }

        if ($element instanceof ViewPartialProviderInterface) {
            $renderer    = $this->getView();                 /* @var $renderer \Zend\View\Renderer\PhpRenderer */
            $origPartial = $element->getViewPartial();
            $partial     = "$origPartial.view";
            $partialParams  = array(
                'element' => $element
            );
            if (!$renderer->resolver($partial)) {
                $partial = $origPartial;
                $partialParams['renderSummary'] = true;
            }
    
            return $renderer->partial($partial, $partialParams);
        }
    
        $label  = $this->getTranslator()->translate($element->getLabel());
        $markup = '';
        
        if ($element instanceof FieldsetInterface) {
            if (!$element instanceof FormInterface && $label) {
                $markup .= '<h4>' . $label . '</h4>';
            }
            foreach ($element as $el) {
                $markup .= $this->renderSummaryElement($el);
            }
            return $markup;
        }
    
        $elementValue = $element instanceof \Zend\Form\Element\Textarea
                      ? nl2br($element->getValue())
                      : $element->getValue();

        if ('' != $elementValue && $element instanceof \Core\Form\Element\Select) {
            if ($summaryValue = $element->getOption('summary_value')) {
                $elementValue = is_callable($summaryValue) ? $summaryValue() : $summaryValue;
            } else {
                $options = $element->getValueOptions();
                $translator = $this->getTranslator();
                if (true == $element->getAttribute('multiple')) {
                    $multiOptions = [];
                    foreach ($elementValue as $optionKey) {
                        if (isset($options[$optionKey])) {
                            $multiOptions[] = $translator->translate($options[$optionKey]);
                            continue;
                        }

                        foreach ($options as $optKey => $optVal) {
                            if (!is_array($optVal) || !array_key_exists($optionKey, $optVal['options'])) {
                                continue;
                            }

                            $optGroupLabel = isset($optVal['label']) ? $translator->translate($optVal['label']) : $optKey;
                            $multiOptions[] = $optGroupLabel . ' | ' . $translator->translate($optVal['options'][$optionKey]);
                        }
                    }

                    $elementValue = '<ul><li>' . join('</li><li>', $multiOptions) . '</li></ul>';
                } else {
                    $elementValue = $translator->translate($options[$elementValue]);
                }
            }
        }

        if ('' != $elementValue && $element instanceof \Zend\Form\Element\File) {
            return '';
        }
                      
        $markup .= '<div class="row">';
        $col = 12;
        if ($label) {
            $markup .= '<div class="col-md-3 yk-label"><label>' . $label . '</label></div>';
            $col = 9;
        }
        $markup .= '<div class="col-md-' . $col . '">' . $elementValue . '</div>'
            . '</div>';
        return $markup;
    }
Helper function to recurse into form elements when rendering summary.

@param ElementInterface $element
@return string