File: /home/confeduphaar/www/wp-content/plugins/ova-framework/ova-elementor/widgets/ova_box_learnmore.php
<?php
namespace ova_framework\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Core\Schemes\Typography;
use Elementor\Group_Control_Typography;
use Elementor\Core\Schemes\Color;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class ova_box_learnmore extends Widget_Base {
public function get_name() {
return 'ova_box_learnmore';
}
public function get_title() {
return __( 'Ova Box Learn More', 'ova-framework' );
}
public function get_icon() {
return 'eicon-posts-ticker';
}
public function get_categories() {
return [ 'ovatheme' ];
}
public function get_script_depends() {
return [ 'script-elementor' ];
}
protected function register_controls() {
$this->start_controls_section(
'section_heading_content',
[
'label' => __( 'Content', 'ova-framework' ),
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'ova-framework' ),
'type' => Controls_Manager::TEXTAREA,
'row' => 5,
'default' => __('"Egovt is your online guide to goverment information & services."','ova-framework'),
]
);
$this->add_control(
'learn_more',
[
'label' => __( 'Learn More', 'ova-framework' ),
'type' => Controls_Manager::TEXT,
'default' => __('Learn More','ova-framework'),
]
);
$this->add_control(
'link',
[
'label' => __( 'Link', 'ova-framework' ),
'type' => Controls_Manager::TEXT,
'default' => '#',
]
);
$this->add_control(
'target_link',
[
'label' => esc_html__( 'Open in new window', 'ova-framework' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'ova-framework' ),
'label_off' => esc_html__( 'No', 'ova-framework' ),
'default' => 'no',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_box',
[
'label' => __( 'Box', 'ova-framework' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'width_box',
[
'label' => __( 'Width', 'ova-framework' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px'],
'range' => [
'px' => [
'max' => 500,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'bg_color',
[
'label' => __( 'Background Color ', 'ova-framework' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content' => 'background-color : {{VALUE}};',
],
]
);
$this->add_responsive_control(
'padding_box',
[
'label' => __( 'Padding', 'ova-framework' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_title',
[
'label' => __( 'Title', 'ova-framework' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .ova_box_learnmore .content .title',
]
);
$this->add_control(
'color_title',
[
'label' => __( 'Color ', 'ova-framework' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content .title' => 'color : {{VALUE}};',
],
]
);
$this->add_responsive_control(
'margin_title',
[
'label' => __( 'Margin', 'ova-framework' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_learn_more',
[
'label' => __( 'Learn More', 'ova-framework' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'learn_more_typography',
'selector' => '{{WRAPPER}} .ova_box_learnmore .content .ova-learn-more',
]
);
$this->add_control(
'color_learn_more',
[
'label' => __( 'Color', 'ova-framework' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content .ova-learn-more' => 'color : {{VALUE}};',
],
]
);
$this->add_control(
'color_learn_more_hover',
[
'label' => __( 'Color Hover', 'ova-framework' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content .ova-learn-more:hover' => 'color : {{VALUE}};',
],
]
);
$this->add_responsive_control(
'margin_sub_title',
[
'label' => __( 'Margin', 'ova-framework' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .ova_box_learnmore .content .ova-learn-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
$title = $settings['title'];
$learn_more = $settings['learn_more'];
$link = $settings['link'];
$target = '';
if ( 'yes' == $settings['target_link'] ) {
$target = ' target="_blank"';
}
?>
<div class="ova_box_learnmore">
<div class="content">
<?php
if( ! empty( $title ) ){
?>
<p class="title second_font">
<?php echo $title ?>
</p>
<?php
}
?>
<?php
if( ! empty( $learn_more ) ){
?>
<a class="ova-learn-more second_font" href="<?php echo esc_url( $link ) ?>"<?php echo esc_html( $target ); ?>>
<?php echo $learn_more ?>
<i data-feather="chevron-right"></i>
</a>
<?php
}
?>
</div>
</div>
<?php
}
}