public function render(ElementInterface $element)
    {
        $renderer = $this->getView();

        if (!method_exists($renderer, 'plugin')) {
            return '';
        }

        $wrapperClass     = '';
        $elementMarkup    = '';
        $templateMarkup   = '';
        $attributesString = '';
        $label            = '';

        if ($element instanceof CollectionElement && $element->shouldCreateTemplate()) {
            $templateMarkup = $this->renderTemplate($element);
        }

        foreach ($element->getIterator() as $elementOrFieldset) {
            /** @var  ElementInterface $elementOrFieldset */
            $elementMarkup .= $this->renderElement($elementOrFieldset);
        }

        $helperFormButtonIcon = $this->getFormButtonIconHelper();
        $helperLabel          = $this->getLabelHelper();

        $elementMarkup .= sprintf(
            $this->elementWrap,
            '',
            $helperFormButtonIcon(
                new Button(
                    null,
                    [
                        'label' => 'Add New',
                        'icon'  => 'fa fa-plus-circle'
                    ]
                )
            ),
            ''
        );

        if ($this->shouldWrap) {
            $attributes = $element->getAttributes();

            /** @noinspection UnSafeIsSetOverArrayInspection */
            if (isset($attributes['class'])) {
                $wrapperClass = $attributes['class'];

                unset($attributes['class']);
            }

            unset($attributes['name']);

            $attributesString = count($attributes) ? ' ' . $this->createAttributesString($attributes) : '';

            /** @noinspection IsEmptyFunctionUsageInspection */
            if (!empty($element->getLabel())) {
                $label = $helperLabel($element);
            }
        }

        return sprintf(
            $this->wrapper,
            $wrapperClass,
            $attributesString,
            $label,
            $this->horizontalWrapClass,
            $elementMarkup,
            $templateMarkup
        );
    }