startControlsSection( 'section_image', [ 'label' => __('Image Box'), ] ); $this->addControl( 'image', [ 'label' => __('Choose Image'), 'type' => ControlsManager::MEDIA, 'seo' => true, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::getPlaceholderImageSrc(), ], ] ); $this->addControl( 'title_text', [ 'label' => __('Title & Description'), 'type' => ControlsManager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => __('This is the heading'), 'placeholder' => __('Enter your title'), 'label_block' => true, ] ); $this->addControl( 'description_text', [ 'label' => __('Content'), 'type' => ControlsManager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'default' => __('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.'), 'placeholder' => __('Enter your description'), 'separator' => 'none', 'rows' => 10, 'show_label' => false, ] ); $this->addControl( 'link', [ 'label' => __('Link'), 'type' => ControlsManager::URL, 'dynamic' => [ 'active' => true, ], 'placeholder' => __('https://your-link.com'), 'separator' => 'before', ] ); $this->addControl( 'position', [ 'label' => __('Image Position'), 'type' => ControlsManager::CHOOSE, 'default' => 'top', 'options' => [ 'left' => [ 'title' => __('Left'), 'icon' => 'eicon-h-align-left', ], 'top' => [ 'title' => __('Top'), 'icon' => 'eicon-v-align-top', ], 'right' => [ 'title' => __('Right'), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'elementor-position-', 'toggle' => false, ] ); $this->addControl( 'title_display', [ 'label' => __('Title Display'), 'type' => ControlsManager::CHOOSE, 'options' => WidgetHeading::getDisplaySizes(), 'style_transfer' => true, ] ); $this->addControl( 'title_size', [ 'label' => __('Title HTML Tag'), 'type' => ControlsManager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h3', ] ); $this->addControl( 'view', [ 'label' => __('View'), 'type' => ControlsManager::HIDDEN, 'default' => 'traditional', ] ); $this->endControlsSection(); $this->startControlsSection( 'section_style_image', [ 'label' => __('Image'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addResponsiveControl( 'image_space', [ 'label' => __('Spacing'), 'type' => ControlsManager::SLIDER, 'default' => [ 'size' => 15, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}.elementor-position-right .elementor-image-box-img' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.elementor-position-left .elementor-image-box-img' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.elementor-position-top .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(mobile){{WRAPPER}} .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->addResponsiveControl( 'image_size', [ 'label' => __('Width') . ' (%)', 'type' => ControlsManager::SLIDER, 'default' => [ 'size' => 30, 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'size_units' => ['%'], 'range' => [ '%' => [ 'min' => 5, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-image-box-img' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->addControl( 'hover_animation', [ 'label' => __('Hover Animation'), 'type' => ControlsManager::HOVER_ANIMATION, ] ); $this->startControlsTabs('image_effects'); $this->startControlsTab( 'normal', [ 'label' => __('Normal'), ] ); $this->addGroupControl( GroupControlCssFilter::getType(), [ 'name' => 'css_filters', 'selector' => '{{WRAPPER}} .elementor-image-box-img img', ] ); $this->addControl( 'image_opacity', [ 'label' => __('Opacity'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-img img' => 'opacity: {{SIZE}};', ], ] ); $this->addControl( 'background_hover_transition', [ 'label' => __('Transition Duration'), 'type' => ControlsManager::SLIDER, 'default' => [ 'size' => 0.3, ], 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-img img' => 'transition-duration: {{SIZE}}s', ], ] ); $this->endControlsTab(); $this->startControlsTab( 'hover', [ 'label' => __('Hover'), ] ); $this->addGroupControl( GroupControlCssFilter::getType(), [ 'name' => 'css_filters_hover', 'selector' => '{{WRAPPER}}:hover .elementor-image-box-img img', ] ); $this->addControl( 'image_opacity_hover', [ 'label' => __('Opacity'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-img img' => 'opacity: {{SIZE}};', ], ] ); $this->endControlsTab(); $this->endControlsTabs(); $this->endControlsSection(); $this->startControlsSection( 'section_style_content', [ 'label' => __('Content'), 'tab' => ControlsManager::TAB_STYLE, ] ); $this->addResponsiveControl( 'text_align', [ 'label' => __('Alignment'), 'type' => ControlsManager::CHOOSE, 'options' => [ 'left' => [ 'title' => __('Left'), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __('Center'), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __('Right'), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => __('Justified'), 'icon' => 'eicon-text-align-justify', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};', ], ] ); $this->addControl( 'content_vertical_alignment', [ 'label' => __('Vertical Alignment'), 'type' => ControlsManager::SELECT, 'options' => [ 'top' => __('Top'), 'middle' => __('Middle'), 'bottom' => __('Bottom'), ], 'default' => 'top', 'prefix_class' => 'elementor-vertical-align-', ] ); $this->addControl( 'heading_title', [ 'label' => __('Title'), 'type' => ControlsManager::HEADING, 'separator' => 'before', ] ); $this->addResponsiveControl( 'title_bottom_space', [ 'label' => __('Spacing'), 'type' => ControlsManager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->addControl( 'title_color', [ 'label' => __('Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_1, ], ] ); $this->addGroupControl( GroupControlTypography::getType(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .elementor-image-box-title', 'scheme' => SchemeTypography::TYPOGRAPHY_1, ] ); $this->addGroupControl( GroupControlTextStroke::getType(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}} .elementor-image-box-title', ] ); $this->addGroupControl( GroupControlTextShadow::getType(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .elementor-image-box-title', ] ); $this->addControl( 'heading_description', [ 'label' => __('Description'), 'type' => ControlsManager::HEADING, 'separator' => 'before', ] ); $this->addControl( 'description_color', [ 'label' => __('Color'), 'type' => ControlsManager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => SchemeColor::getType(), 'value' => SchemeColor::COLOR_3, ], ] ); $this->addGroupControl( GroupControlTypography::getType(), [ 'name' => 'description_typography', 'selector' => '{{WRAPPER}} .elementor-image-box-description', 'scheme' => SchemeTypography::TYPOGRAPHY_3, ] ); $this->addGroupControl( GroupControlTextShadow::getType(), [ 'name' => 'description_shadow', 'selector' => '{{WRAPPER}} .elementor-image-box-description', ] ); $this->endControlsSection(); } /** * Render image box widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 */ protected function render() { $settings = $this->getSettingsForDisplay(); $has_content = !Utils::isEmpty($settings['title_text']) || !Utils::isEmpty($settings['description_text']); $html = '
%2$s
', $this->getRenderAttributeString('description_text'), $settings['description_text'] ); } $html .= '' + settings.description_text + '
'; } html += '