protected function renderCaption($captionConfig)
    {
        if ($captionConfig === false) {
            return '';
        }

        $content = ArrayHelper::getValue($captionConfig, 'content', '');
        $alignment = ArrayHelper::getValue($captionConfig, 'align', null);
        $options = ArrayHelper::getValue($captionConfig, 'options', []);
        $options = ArrayHelper::merge($this->captionOptions, $options);

        Html::addCssClass($options, ['caption' => 'caption']);
        if ($alignment) {
            Html::addCssClass($options, ['align' => $alignment]);
        }

        return Html::tag('div', $content, $options);
    }