OwlCyberSecurity - MANAGER
Edit File: ova-icon-box.php
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Utils; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Chursy_Elementor_Ova_Icon_Box extends Widget_Base { public function get_name() { return 'chursy_elementor_ova_icon_box'; } public function get_title() { return esc_html__( 'Ova Icon Box', 'chursy' ); } public function get_icon() { return 'eicon-icon-box'; } public function get_categories() { return [ 'chursy' ]; } public function get_script_depends() { return [ '' ]; } // Add Your Controll In This Function protected function register_controls() { $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'chursy' ), ] ); // Add Class control $this->add_control( 'icon', [ 'label' => esc_html__( 'Class Icon', 'chursy' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [ 'value' => 'flaticon flaticon-email', 'library' => 'all', ], ] ); $this->add_control( 'text_number', [ 'label' => esc_html__( 'Text Number', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '01', 'chursy' ), ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Praise & Worship', 'chursy' ), ] ); $this->add_control( 'description', [ 'label' => esc_html__( 'Description', 'chursy' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__( 'The first way to beat a creative block and generate new ideas is to generate as many ', 'chursy' ), ] ); $this->add_control( 'link', [ 'label' => esc_html__( 'Link', 'chursy' ), 'type' => \Elementor\Controls_Manager::URL, 'show_external' => false, 'default' => [ 'url' => '#', 'is_external' => false, 'nofollow' => false, ], ] ); $this->add_control( 'text_button', [ 'label' => esc_html__( 'Text Button', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Read Details', 'chursy' ), ] ); $this->end_controls_section(); /* STYLE TAB */ $this->start_controls_section( 'settings_section', [ 'label' => esc_html__( 'Item', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'background_color', [ 'label' => esc_html__( 'Background Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'background_color_hover', [ 'label' => esc_html__( 'Background Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box:hover' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'item_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-icon-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'item_border_radius', [ 'label' => esc_html__( 'Border Radius', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-icon-box' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'title_section', [ 'label' => esc_html__( 'Title', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .ova-icon-box .title', ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box .title, {{WRAPPER}} .ova-icon-box .title a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'title_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-icon-box .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'description_section', [ 'label' => esc_html__( 'Description', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'selector' => '{{WRAPPER}} .ova-icon-box .description', ] ); $this->add_control( 'description_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box .description' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'description_margin', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-icon-box .description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'button_section', [ 'label' => esc_html__( 'Button', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .ova-icon-box .box-link', ] ); $this->add_control( 'button_icon_size', [ 'label' => esc_html__( 'Icon Size', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-icon-box .box-link i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'style_button_tabs' ); $this->start_controls_tab( 'style_button_tab_normal', [ 'label' => esc_html__( 'Normal', 'chursy' ), ] ); $this->add_control( 'button_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box .box-link' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'button_background_color', [ 'label' => esc_html__( 'Background Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box .box-link' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'button_border_color', [ 'label' => esc_html__( 'Border Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box .box-link' => 'border-color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'style_button_tab_hover', [ 'label' => esc_html__( 'Hover', 'chursy' ), ] ); $this->add_control( 'button_color_hover', [ 'label' => esc_html__( 'Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box:hover .box-link' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'button_background_color_hover', [ 'label' => esc_html__( 'Background Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box:hover .box-link' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'button_border_color_hover', [ 'label' => esc_html__( 'Border Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-icon-box:hover .box-link' => 'border-color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } // Render Template Here protected function render() { $settings = $this->get_settings(); $icon = $settings['icon']; $text_number = $settings['text_number']; $title = $settings['title']; $description = $settings['description']; $text_button = $settings['text_button']; $link = $settings['link']['url']; $target = $settings['link']['is_external'] ? ' target="_blank"' : ''; ?> <div class="ova-icon-box"> <?php if( $icon['value'] ){ ?> <div class="icon"> <?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?> <?php if ( !empty($title) ) { ?> <span class="text-number"> <?php echo esc_html($text_number); ?> </span> <?php } ?> </div> <?php } ?> <?php if ( !empty($title) ) { ?> <h2 class="title"> <?php if( $link ) { ?> <a href="<?php echo esc_url( $link ); ?>"<?php printf( $target ); ?>> <?php } ?> <?php echo esc_html($title); ?> <?php if( $link ) { ?> </a> <?php } ?> </h2> <?php } ?> <?php if ( $description ) { ?> <p class="description"><?php echo esc_html($description); ?></p> <?php } ?> <?php if ( !empty($text_button) ) { ?> <a href="<?php echo esc_url( $link ) ?>" class="box-link" title="<?php echo esc_attr($title);?>"> <?php echo esc_html( $text_button ) ?> <i aria-hidden="true" class="ovaicon ovaicon-next"></i> </a> <?php } ?> </div> <?php } } $widgets_manager->register( new Chursy_Elementor_Ova_Icon_Box() );