Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Elementor;
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
- class Widget_Themeum_Section1 extends Widget_Base {
- public function get_name() {
- return 'thm-title-section';
- }
- public function get_title() {
- return __( 'Section One', 'backer' );
- }
- public function get_icon() {
- return 'eicon-apps wts-eae-pe';
- }
- public function get_categories() {
- return [ 'themeum-elementor' ];
- }
- protected function _register_controls() {
- $this->start_controls_section(
- 'section_title',
- [
- 'label' => __( 'Title Element', 'backer' )
- ]
- );
- $this->add_control(
- 'upload_image',
- [
- 'label' => __( 'Upload Image', 'backer' ),
- 'type' => Controls_Manager::MEDIA,
- 'label_block' => true,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ]
- );
- $this->add_control(
- 'title_txt',
- [
- 'label' => __( 'Title', 'backer' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'placeholder' => __( 'Enter title', 'backer' ),
- 'default' => __( 'This is heading', 'backer' ),
- ]
- );
- $this->add_control(
- 'subtitle_content',
- [
- 'label' => __( 'Sub Title Content', 'backer' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'placeholder' => __( 'Enter Sub Title', 'backer' ),
- 'default' => __( 'Write your sub title content of this section.', 'backer' ),
- ]
- );
- $this->add_control(
- 'video_link',
- [
- 'label' => __( 'Video Link', 'backer' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ]
- );
- $this->add_control(
- 'video_intro',
- [
- 'label' => __( 'Video Intro Text', 'backer' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- 'placeholder' => __( 'Enter Sub Title', 'backer' ),
- 'default' => __( 'Write your sub title content of this section.', 'backer' ),
- ]
- );
- $this->add_responsive_control(
- 'align',
- [
- 'label' => __( 'Alignment', 'backer' ),
- 'type' => Controls_Manager::CHOOSE,
- 'options' => [
- 'left' => [
- 'title' => __( 'Left', 'backer' ),
- 'icon' => 'fa fa-align-left',
- ],
- 'center' => [
- 'title' => __( 'Center', 'backer' ),
- 'icon' => 'fa fa-align-center',
- ],
- 'right' => [
- 'title' => __( 'Right', 'backer' ),
- 'icon' => 'fa fa-align-right',
- ],
- 'justify' => [
- 'title' => __( 'Justified', 'backer' ),
- 'icon' => 'fa fa-align-justify',
- ],
- ],
- 'default' => '',
- 'selectors' => [
- '{{WRAPPER}}' => 'text-align: {{VALUE}};',
- ],
- ]
- );
- $this->end_controls_section();
- $this->start_controls_section(
- 'section_title_style',
- [
- 'label' => __( 'Title', 'backer' ),
- 'tab' => Controls_Manager::TAB_STYLE,
- ]
- );
- $this->add_control(
- 'title_border',
- [
- 'label' => __( 'Background Border', 'backer' ),
- 'type' => Controls_Manager::SWITCHER,
- 'default' => 'no',
- 'label_on' => __( 'Yes', 'backer' ),
- 'label_off' => __( 'No', 'backer' ),
- 'selectors' => [
- '{{WRAPPER}} h2.bordered:before' => 'width: 100%;',
- ],
- ]
- );
- $this->add_control(
- 'title_bg_color',
- [
- 'label' => __( 'Background Color', 'backer' ),
- 'type' => Controls_Manager::COLOR,
- 'scheme' => [
- 'type' => Scheme_Color::get_type(),
- 'value' => Scheme_Color::COLOR_1,
- ],
- 'selectors' => [
- '{{WRAPPER}} h2.bordered span' => 'background: {{VALUE}};',
- ],
- 'condition' => [
- 'title_border' => 'yes',
- ],
- ]
- );
- $this->add_group_control(
- Group_Control_Border::get_type(),
- [
- 'name' => 'image_border',
- 'label' => __( 'Background Border', 'backer' ),
- 'selector' => '{{WRAPPER}} h2.bordered:before',
- 'condition' => [
- 'title_border' => 'yes',
- ],
- ]
- );
- $this->add_control(
- 'title_color',
- [
- 'label' => __( 'Text Color', 'backer' ),
- 'type' => Controls_Manager::COLOR,
- 'scheme' => [
- 'type' => Scheme_Color::get_type(),
- 'value' => Scheme_Color::COLOR_1,
- ],
- 'selectors' => [
- '{{WRAPPER}} .thm-heading-title' => 'color: {{VALUE}};',
- ],
- ]
- );
- $this->add_responsive_control(
- 'text_padding',
- [
- 'label' => __( 'Title Padding', 'backer' ),
- 'type' => Controls_Manager::DIMENSIONS,
- 'size_units' => [ 'px', 'em', '%' ],
- 'selectors' => [
- '{{WRAPPER}} .thm-heading-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
- ],
- 'separator' => 'before',
- ]
- );
- $this->add_responsive_control(
- 'text_margin',
- [
- 'label' => __( 'Title Margin', 'backer' ),
- 'type' => Controls_Manager::DIMENSIONS,
- 'size_units' => [ 'px', 'em', '%' ],
- 'selectors' => [
- '{{WRAPPER}} .thm-heading-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
- ],
- 'separator' => 'before',
- ]
- );
- $this->add_group_control(
- Group_Control_Typography::get_type(),
- [
- 'name' => 'typography',
- 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
- 'selector' => '{{WRAPPER}} .thm-heading-title',
- ]
- );
- $this->end_controls_section();
- # Title Section end 1
- # Sub Title Section 2
- $this->start_controls_section(
- 'section_subtitle_style',
- [
- 'label' => __( 'Sub Title', 'backer' ),
- 'tab' => Controls_Manager::TAB_STYLE,
- ]
- );
- $this->add_control(
- 'subtitle_color',
- [
- 'label' => __( 'Subtitle Color', 'backer' ),
- 'type' => Controls_Manager::COLOR,
- 'scheme' => [
- 'type' => Scheme_Color::get_type(),
- 'value' => Scheme_Color::COLOR_1,
- ],
- 'selectors' => [
- '{{WRAPPER}} .sub-title-content' => 'color: {{VALUE}};',
- ],
- ]
- );
- $this->add_responsive_control(
- 'sub_text_padding',
- [
- 'label' => __( 'Sub Title Padding', 'backer' ),
- 'type' => Controls_Manager::DIMENSIONS,
- 'size_units' => [ 'px', 'em', '%' ],
- 'selectors' => [
- '{{WRAPPER}} .sub-title-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
- ],
- 'separator' => 'before',
- ]
- );
- $this->add_group_control(
- Group_Control_Typography::get_type(),
- [
- 'name' => 'typography2',
- 'scheme' => Scheme_Typography::TYPOGRAPHY_2,
- 'selector' => '{{WRAPPER}} .sub-title-content',
- ]
- );
- # Subtitle part 2 end
- }
- protected function render( ) {
- $settings = $this->get_settings();
- $image = $settings['upload_image']; ?>
- <div class="right-thumb">
- <div class="single-item">
- <div class="thumb-area">
- <?php if ( $image['url'] ) { ?>
- <img class="img-responsive" src="<?php esc_url($image['url']); ?>" alt="">
- <?php } ?>
- <div class="about-content">
- <div class="content-inner">
- <span><?php echo $settings['title_txt']; ?></span>
- <h4><?php echo $settings['subtitle_content']; ?></h4>
- </div>
- </div>
- <div class="hover-info">
- <div class="content-inner">
- <h4><?php echo $settings['video_intro']; ?></h4>
- <div class="icon">
- <a class="video-link" href="<?php echo $settings['video_link']; ?>"><i class="icofont icofont-play-alt-2"></i></a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php }
- }
- Plugin::instance()->widgets_manager->register_widget_type( new Widget_Themeum_Section1() );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement