protected function renderFooter()
    {
        if (!$this->footer &&
            $this->closeButtonPosition != self::CLOSE_BUTTON_POSITION_BEFORE_FOOTER &&
            $this->closeButtonPosition != self::CLOSE_BUTTON_POSITION_AFTER_FOOTER) {
            return '';
        }

        $html = [];
        Html::addCssClass($this->footerOptions, ['footer' => 'modal-footer']);
        $html[] = Html::beginTag('div', $this->footerOptions);

        if ($this->closeButtonPosition === self::CLOSE_BUTTON_POSITION_BEFORE_FOOTER) {
            $html[] = $this->renderCloseButton();
        }

        $html[] = $this->footer;

        if ($this->closeButtonPosition === self::CLOSE_BUTTON_POSITION_AFTER_FOOTER) {
            $html[] = $this->renderCloseButton();
        }

        $html[] = Html::endTag('div');

        return implode("\n", $html);
    }