trAvis - MANAGER
Edit File: tp_blockquote.php
<?php /* Widget Name: Blockquote Description: Author Quote Style. Author: Theplus Author URI: https://posimyth.com */ namespace TheplusAddons\Widgets; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Utils; use Elementor\Core\Schemes\Color; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Border; use Elementor\Core\Schemes\Typography; use Elementor\Group_Control_Background; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Text_Shadow; if (!defined('ABSPATH')) exit; // Exit if accessed directly class ThePlus_Block_Quote extends Widget_Base { public function get_name() { return 'tp-blockquote'; } public function get_title() { return esc_html__('Blockquote', 'theplus'); } public function get_icon() { return 'fa fa-quote-left theplus_backend_icon'; } public function get_categories() { return array('plus-essential'); } protected function _register_controls() { $this->start_controls_section( 'content_section', [ 'label' => esc_html__( 'Blockquote', 'theplus' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'style', [ 'label' => esc_html__( 'Style', 'theplus' ), 'type' => Controls_Manager::SELECT, 'default' => 'style-1', 'options' => theplus_get_style_list(2), ] ); $this->add_control( 'content_description', [ 'label' => esc_html__( 'Quote Description', 'theplus' ), 'type' => Controls_Manager::WYSIWYG, 'default' => esc_html__( '"I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo."', 'theplus' ), 'placeholder' => esc_html__( 'Type your block quote here', 'theplus' ), 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'quote_author', [ 'label' => esc_html__( 'Author', 'theplus' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'John Doe', 'theplus' ), 'dynamic' => [ 'active' => true, ], 'condition' => [ 'style' => 'style-2', ], ] ); $this->add_responsive_control( 'content_align', [ 'label' => esc_html__( 'Alignment', 'theplus' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'theplus' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'theplus' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'theplus' ), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => esc_html__( 'Justify', 'theplus' ), 'icon' => 'eicon-text-align-justify', ], ], 'devices' => [ 'desktop', 'tablet', 'mobile' ], 'prefix_class' => 'text-%s', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_styling', [ 'label' => esc_html__('Typography', 'theplus'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'label' => esc_html__('Typography', 'theplus'), 'selector' => '{{WRAPPER}} .plus_blockquote blockquote.quote-text > span,{{WRAPPER}} .plus_blockquote blockquote.quote-text', ] ); $this->start_controls_tabs( 'tabs_quote_style' ); $this->start_controls_tab( 'tab_quote_normal', [ 'label' => esc_html__( 'Normal', 'theplus' ), ] ); $this->add_control( 'content_color', [ 'label' => esc_html__('Text Color', 'theplus'), 'type' => Controls_Manager::COLOR, 'default' => '#888', 'selectors' => [ '{{WRAPPER}} .plus_blockquote blockquote.quote-text > span,{{WRAPPER}} .plus_blockquote blockquote.quote-text p,{{WRAPPER}} .plus_blockquote blockquote.quote-text' => 'color:{{VALUE}};', ], ] ); $this->add_control( 'author_color', [ 'label' => esc_html__('Author Color', 'theplus'), 'type' => Controls_Manager::COLOR, 'default' => '#888', 'selectors' => [ '{{WRAPPER}} .plus_blockquote .quote-text .quote_author' => 'color:{{VALUE}};', ], 'condition' => [ 'style' => 'style-2', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_quote_hover', [ 'label' => esc_html__( 'Hover', 'theplus' ), ] ); $this->add_control( 'content_hover_color', [ 'label' => esc_html__('Text Color', 'theplus'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .plus_blockquote:hover blockquote.quote-text > span,{{WRAPPER}} .plus_blockquote:hover blockquote.quote-text p,{{WRAPPER}} .plus_blockquote:hover blockquote.quote-text' => 'color:{{VALUE}};', ], ] ); $this->add_control( 'author_hover_color', [ 'label' => esc_html__('Author Color', 'theplus'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .plus_blockquote:hover .quote-text .quote_author' => 'color:{{VALUE}};', ], 'condition' => [ 'style' => 'style-2', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'quote_color', [ 'label' => esc_html__( 'Quote Color', 'theplus' ), 'type' => Controls_Manager::COLOR, 'default' => '#888', 'selectors' => [ '{{WRAPPER}} .plus_blockquote.quote-style-2 .quote-left' => 'color: {{VALUE}};', ], 'separator' => 'before', 'condition' => [ 'style' => 'style-2', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_shadow', 'label' => esc_html__( 'Text Shadow', 'theplus' ), 'selector' => '{{WRAPPER}} .plus_blockquote.quote-style-2 .quote-left', 'separator' => 'before', 'condition' => [ 'style' => 'style-2', ], ] ); $this->add_control( 'quote_padding', [ 'label' => esc_html__( 'Padding', 'theplus' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'quote_margin', [ 'label' => esc_html__( 'Margin', 'theplus' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /*background option*/ $this->start_controls_section( 'section_bg_option_styling', [ 'label' => esc_html__('Background Options', 'theplus'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'box_border', [ 'label' => esc_html__( 'Box Border', 'theplus' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'theplus' ), 'label_off' => esc_html__( 'Hide', 'theplus' ), 'default' => 'no', ] ); $this->add_control( 'border_style', [ 'label' => esc_html__( 'Border Style', 'theplus' ), 'type' => Controls_Manager::SELECT, 'default' => 'solid', 'options' => theplus_get_border_style(), 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'border-style: {{VALUE}};', ], 'condition' => [ 'box_border' => 'yes', ], ] ); $this->start_controls_tabs( 'tabs_border_style' ); $this->start_controls_tab( 'tab_border_normal', [ 'label' => esc_html__( 'Normal', 'theplus' ), ] ); $this->add_control( 'box_border_color', [ 'label' => esc_html__( 'Border Color', 'theplus' ), 'type' => Controls_Manager::COLOR, 'default' => '#252525', 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'border-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'box_border_width', [ 'label' => esc_html__( 'Border Width', 'theplus' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'default' => [ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1, ], 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'box_border' => 'yes', ], ] ); $this->add_responsive_control( 'border_radius', [ 'label' => esc_html__( 'Border Radius', 'theplus' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .plus_blockquote' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_border_hover', [ 'label' => esc_html__( 'Hover', 'theplus' ), ] ); $this->add_control( 'box_border_hover_color', [ 'label' => esc_html__( 'Border Color', 'theplus' ), 'type' => Controls_Manager::COLOR, 'default' => '#252525', 'selectors' => [ '{{WRAPPER}} .plus_blockquote:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'border_hover_radius', [ 'label' => esc_html__( 'Border Radius', 'theplus' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .plus_blockquote:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'background_options', [ 'label' => esc_html__( 'Background Options', 'theplus' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'tabs_background_style' ); $this->start_controls_tab( 'tab_background_normal', [ 'label' => esc_html__( 'Normal', 'theplus' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'box_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .plus_blockquote', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_background_hover', [ 'label' => esc_html__( 'Hover', 'theplus' ), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'box_hover_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .plus_blockquote:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'shadow_options', [ 'label' => esc_html__( 'Box Shadow Options', 'theplus' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'tabs_shadow_style' ); $this->start_controls_tab( 'tab_shadow_normal', [ 'label' => esc_html__( 'Normal', 'theplus' ), ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', 'selector' => '{{WRAPPER}} .plus_blockquote', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_shadow_hover', [ 'label' => esc_html__( 'Hover', 'theplus' ), ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_hover_shadow', 'selector' => '{{WRAPPER}} .plus_blockquote:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); /*background option*/ /*Adv tab*/ $this->start_controls_section( 'section_plus_extra_adv', [ 'label' => esc_html__('Plus Extras', 'theplus'), 'tab' => Controls_Manager::TAB_ADVANCED, ] ); $this->end_controls_section(); /*Adv tab*/ /*--On Scroll View Animation ---*/ include THEPLUS_PATH. 'modules/widgets/theplus-widget-animation.php'; } protected function render() { $settings = $this->get_settings_for_display(); $content_description = $settings['content_description']; $quote_style = $settings['style']; $quote_author = $settings['quote_author']; /*--On Scroll View Animation ---*/ include THEPLUS_PATH. 'modules/widgets/theplus-widget-animation-attr.php'; /*--Plus Extra ---*/ $PlusExtra_Class = "plus-blockquote-widget"; include THEPLUS_PATH. 'modules/widgets/theplus-widgets-extra.php'; $text_block ='<div class="pt-plus-text-block-wrapper" >'; $text_block .='<div class="text_block_parallax">'; $lz1 = function_exists('tp_has_lazyload') ? tp_bg_lazyLoad($settings['box_background_image'],$settings['box_hover_background_image']) : ''; $text_block .='<div class="plus_blockquote quote-'.esc_attr($quote_style).' '.esc_attr($animated_class).' '.esc_attr($lz1).'" '.$animation_attr.'>'; $text_block .= '<blockquote class="quote-text">'; if($quote_style=='style-2'){ $text_block .= '<i class="fa fa-quote-left quote-left" aria-hidden="true"></i>'; } $text_block .= '<span>'.wp_kses_post($content_description).'</span>'; if($quote_style=='style-2' && !empty($quote_author)){ $text_block .= '<p class="quote_author">'.esc_html($quote_author).'</p>'; } $text_block .= '</blockquote>'; $text_block .='</div>'; $text_block .='</div>'; $text_block .='</div>'; echo $before_content.$text_block.$after_content; } protected function content_template() { } }