<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
use Motiox\Elementor\Motiox_Base_Widgets;
use Elementor\Controls_Manager;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Border;
/**
* Class Motiox_Elementor_Blog
*/
class Motiox_Elementor_Project_Overview extends Motiox_Base_Widgets {
public function get_name() {
return 'motiox-project-overview';
}
public function get_title() {
return esc_html__('Motiox Project Overview', 'motiox');
}
/**
* Get widget icon.
*
* Retrieve testimonial widget icon.
*
* @return string Widget icon.
* @since 1.0.0
* @access public
*
*/
public function get_icon() {
return 'eicon-columns';
}
public function get_categories() {
return array('motiox-addons');
}
protected function register_controls() {
$this->start_controls_section(
'section_query',
[
'label' => esc_html__('Overview', 'motiox'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'name',
[
'label' => esc_html__('Display Name', 'motiox'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$this->add_control(
'info',
[
'label' => esc_html__('Display Info', 'motiox'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$this->add_responsive_control(
'project_vertical_align',
[
'label' => esc_html__( 'Vertical Align', 'motiox' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Start', 'motiox' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'motiox' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'End', 'motiox' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .overview-wrapper' => 'align-items: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'overview_align',
[
'label' => esc_html__('Alignment', 'motiox'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__('Left', 'motiox'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'motiox'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'motiox'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .overview-wrapper' => 'text-align: {{VALUE}}; justify-content: {{VALUE}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_name_style',
[
'label' => esc_html__('Name', 'motiox'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'name' => 'yes',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'name_typography',
'selector' => '{{WRAPPER}} .project-name',
]
);
$this->add_control(
'name_text_color',
[
'label' => esc_html__('Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .project-name' => 'color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'name_margin',
[
'label' => esc_html__('Margin', 'motiox'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .project-name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_content_style',
[
'label' => esc_html__('Content', 'motiox'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'info' => 'yes',
],
]
);
$this->add_responsive_control(
'info_align',
[
'label' => esc_html__('Info Alignment', 'motiox'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__('Left', 'motiox'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'motiox'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'motiox'),
'icon' => 'eicon-text-align-right',
],
],
'default' => '',
'selectors' => [
'{{WRAPPER}} .overview-list' => 'justify-content: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'gap',
[
'label' => esc_html__('Gap', 'motiox'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', 'rem', 'custom'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .overview-list' => 'gap: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_responsive_control(
'width_list',
[
'label' => esc_html__('Width', 'motiox'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['%', 'px', 'custom'],
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .project-overview' => 'width: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_control(
'text_content',
[
'label' => esc_html__('Text', 'motiox'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'text_color',
[
'label' => esc_html__('Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .overview-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'text_typography',
'selector' => '{{WRAPPER}} .overview-item .overview-text',
]
);
$this->add_control(
'info_content',
[
'label' => esc_html__('Content', 'motiox'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'content_color',
[
'label' => esc_html__('Color', 'motiox'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .overview-content' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'info_typography',
'selector' => '{{WRAPPER}} .overview-item .overview-content',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if (!is_singular('motiox_project')) {
esc_html_e('Used in single project', 'motiox');
return;
}
$entries = get_post_meta(get_the_ID(), 'project_repeat_info', true);
?>
<div class="overview-wrapper">
<?php if ($settings['name']) { ?>
<div class="project-name"><?php the_title(); ?></div>
<?php } ?>
<div class="project-overview">
<ul class="overview-list">
<?php
if ($settings['info'] && !empty('$entries')) {
foreach ((array)$entries as $key => $entry) {
if (!empty($entry['info_title']) && !empty($entry['info_desc'])) {
echo '<li class="overview-item"><span class="overview-text">' . esc_html($entry['info_title'] . '') . '</span><span class="overview-content">' . esc_html($entry['info_desc']) . '</span></li>';
}
}
}
?>
</ul>
</div>
</div>
<?php
}
}
$widgets_manager->register(new Motiox_Elementor_Project_Overview());