protected function render()
{
$settings = $this->get_settings();
$has_content = !empty($settings['title_text']) || !empty($settings['description_text']);
$html = '<div class="elementor-image-box-wrapper">';
if (!empty($settings['image']['url'])) {
$this->add_render_attribute('image', 'src', $settings['image']['url']);
$this->add_render_attribute('image', 'alt', Control_Media::get_image_alt($settings['image']));
$this->add_render_attribute('image', 'title', Control_Media::get_image_title($settings['image']));
if ($settings['hover_animation']) {
$this->add_render_attribute('image', 'class', 'elementor-animation-' . $settings['hover_animation']);
}
$image_html = '<img ' . $this->get_render_attribute_string('image') . '>';
if (!empty($settings['link']['url'])) {
$target = '';
if (!empty($settings['link']['is_external'])) {
$target = ' target="_blank"';
}
$image_html = sprintf('<a href="%s"%s>%s</a>', $settings['link']['url'], $target, $image_html);
}
$html .= '<figure class="elementor-image-box-img">' . $image_html . '</figure>';
}
if ($has_content) {
$html .= '<div class="elementor-image-box-content">';
if (!empty($settings['title_text'])) {
$title_html = $settings['title_text'];
if (!empty($settings['link']['url'])) {
$target = '';
if (!empty($settings['link']['is_external'])) {
$target = ' target="_blank"';
}
$title_html = sprintf('<a href="%s"%s>%s</a>', $settings['link']['url'], $target, $title_html);
}
$html .= sprintf('<%1$s class="elementor-image-box-title">%2$s</%1$s>', $settings['title_size'], $title_html);
}
if (!empty($settings['description_text'])) {
$html .= sprintf('<p class="elementor-image-box-description">%s</p>', $settings['description_text']);
}
$html .= '</div>';
}
$html .= '</div>';
echo $html;
}