theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
6 months ago
heading-modern.php
6 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
6 months ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
quote.php
374 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 9 | use Elementor\Group_Control_Border; |
| 10 | |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // Exit if accessed directly. |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Elementor 'Quote' widget. |
| 18 | * |
| 19 | * Elementor widget that displays an 'Quote' with lightbox. |
| 20 | * |
| 21 | * @since 1.0.0 |
| 22 | */ |
| 23 | class Quote extends Widget_Base { |
| 24 | |
| 25 | /** |
| 26 | * Get widget name. |
| 27 | * |
| 28 | * Retrieve 'Quote' widget name. |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * @access public |
| 32 | * |
| 33 | * @return string Widget name. |
| 34 | */ |
| 35 | public function get_name() { |
| 36 | return 'aux_blockquote'; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get widget title. |
| 41 | * |
| 42 | * Retrieve 'Quote' widget title. |
| 43 | * |
| 44 | * @since 1.0.0 |
| 45 | * @access public |
| 46 | * |
| 47 | * @return string Widget title. |
| 48 | */ |
| 49 | public function get_title() { |
| 50 | return __('Blockquote', 'auxin-elements' ); |
| 51 | } |
| 52 | |
| 53 | public function has_widget_inner_wrapper(): bool { |
| 54 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | /** |
| 59 | * Get widget icon. |
| 60 | * |
| 61 | * Retrieve 'Quote' widget icon. |
| 62 | * |
| 63 | * @since 1.0.0 |
| 64 | * @access public |
| 65 | * |
| 66 | * @return string Widget icon. |
| 67 | */ |
| 68 | public function get_icon() { |
| 69 | return 'eicon-blockquote auxin-badge'; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Get widget categories. |
| 74 | * |
| 75 | * Retrieve 'Quote' widget icon. |
| 76 | * |
| 77 | * @since 1.0.0 |
| 78 | * @access public |
| 79 | * |
| 80 | * @return string Widget icon. |
| 81 | */ |
| 82 | public function get_categories() { |
| 83 | return array( 'auxin-core' ); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Register 'Quote' widget controls. |
| 88 | * |
| 89 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 90 | * |
| 91 | * @since 1.0.0 |
| 92 | * @access protected |
| 93 | */ |
| 94 | protected function register_controls() { |
| 95 | |
| 96 | /*-----------------------------------------------------------------------------------*/ |
| 97 | /* content_section |
| 98 | /*-----------------------------------------------------------------------------------*/ |
| 99 | |
| 100 | $this->start_controls_section( |
| 101 | 'content_section', |
| 102 | array( |
| 103 | 'label' => __('Text', 'auxin-elements' ) |
| 104 | ) |
| 105 | ); |
| 106 | |
| 107 | $this->add_control( |
| 108 | 'content', |
| 109 | array( |
| 110 | 'label' => __('Content','auxin-elements' ), |
| 111 | 'description' => __('Enter a text as a quote content.', 'auxin-elements'), |
| 112 | 'type' => Controls_Manager::WYSIWYG, |
| 113 | 'placeholder' => __( 'Type your description here', 'auxin-elements') |
| 114 | ) |
| 115 | ); |
| 116 | |
| 117 | /*$this->add_control( |
| 118 | 'type', |
| 119 | array( |
| 120 | 'label' => __('Blockqoute type','auxin-elements' ), |
| 121 | 'type' => 'aux-visual-select', |
| 122 | 'style_items' => 'max-width:48%;', |
| 123 | 'options' => array( |
| 124 | 'quote-normal' => array( |
| 125 | 'label' => __('Quote Normal', 'auxin-elements'), |
| 126 | 'image' => AUXIN_URL . 'images/visual-select/blockquote-normal-1.svg' |
| 127 | ), |
| 128 | 'blockquote-normal' => array( |
| 129 | 'label' => __('Blockquote Normal', 'auxin-elements'), |
| 130 | 'image' => AUXIN_URL . 'images/visual-select/blockquote-normal.svg' |
| 131 | ), |
| 132 | 'pullquote-normal' => array( |
| 133 | 'label' => __('Pullquote Normal', 'auxin-elements'), |
| 134 | 'image' => AUXIN_URL . 'images/visual-select/pullquote-normal.svg' |
| 135 | ) |
| 136 | ), |
| 137 | 'default' => 'blockquote-normal' |
| 138 | ) |
| 139 | );*/ |
| 140 | |
| 141 | $this->end_controls_section(); |
| 142 | |
| 143 | /*-----------------------------------------------------------------------------------*/ |
| 144 | /* Style section |
| 145 | /*-----------------------------------------------------------------------------------*/ |
| 146 | |
| 147 | /* Text Style Section |
| 148 | /*-------------------------------------*/ |
| 149 | |
| 150 | $this->start_controls_section( |
| 151 | 'text_style_section', |
| 152 | array( |
| 153 | 'label' => __( 'Text', 'auxin-elements' ), |
| 154 | 'tab' => Controls_Manager::TAB_STYLE |
| 155 | ) |
| 156 | ); |
| 157 | |
| 158 | $this->add_responsive_control( |
| 159 | 'text_align', |
| 160 | array( |
| 161 | 'label' => __('Text alignment', 'auxin-elements'), |
| 162 | 'type' => Controls_Manager::CHOOSE, |
| 163 | 'default' => 'inherit', |
| 164 | 'options' => array( |
| 165 | 'inherit' => array( |
| 166 | 'title' => __( 'Default', 'auxin-elements' ), |
| 167 | 'icon' => 'fa fa-stream', |
| 168 | ), |
| 169 | 'left' => array( |
| 170 | 'title' => __( 'Left', 'auxin-elements' ), |
| 171 | 'icon' => 'eicon-text-align-left', |
| 172 | ), |
| 173 | 'center' => array( |
| 174 | 'title' => __( 'Center', 'auxin-elements' ), |
| 175 | 'icon' => 'eicon-text-align-center', |
| 176 | ), |
| 177 | 'right' => array( |
| 178 | 'title' => __( 'Right', 'auxin-elements' ), |
| 179 | 'icon' => 'eicon-text-align-right', |
| 180 | ) |
| 181 | ), |
| 182 | 'selectors' => array( |
| 183 | '{{WRAPPER}} .aux-elem-quote' => 'text-align: {{VALUE}};' |
| 184 | ) |
| 185 | ) |
| 186 | ); |
| 187 | |
| 188 | $this->add_control( |
| 189 | 'text_color', |
| 190 | array( |
| 191 | 'label' => __( 'Text Color', 'auxin-elements' ), |
| 192 | 'type' => Controls_Manager::COLOR, |
| 193 | 'selectors' => array( |
| 194 | '{{WRAPPER}} .aux-elem-quote p' => 'color: {{VALUE}};' |
| 195 | ) |
| 196 | ) |
| 197 | ); |
| 198 | |
| 199 | $this->add_group_control( |
| 200 | Group_Control_Typography::get_type(), |
| 201 | array( |
| 202 | 'name' => 'text_typography', |
| 203 | 'global' => [ |
| 204 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 205 | ], |
| 206 | 'selector' => '{{WRAPPER}} .aux-elem-quote p' |
| 207 | ) |
| 208 | ); |
| 209 | |
| 210 | $this->end_controls_section(); |
| 211 | |
| 212 | /* Quote Symbol Section |
| 213 | /*-------------------------------------*/ |
| 214 | |
| 215 | $this->start_controls_section( |
| 216 | 'quote_symbol_style_section', |
| 217 | array( |
| 218 | 'label' => __( 'Quote Symbol', 'auxin-elements' ), |
| 219 | 'tab' => Controls_Manager::TAB_STYLE |
| 220 | ) |
| 221 | ); |
| 222 | |
| 223 | $this->add_control( |
| 224 | 'quote_symbol', |
| 225 | array( |
| 226 | 'label' => __('Insert quote symbol','auxin-elements' ), |
| 227 | 'type' => Controls_Manager::SWITCHER, |
| 228 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 229 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 230 | 'default' => 'yes' |
| 231 | ) |
| 232 | ); |
| 233 | |
| 234 | $this->add_control( |
| 235 | 'quote_symbol_color', |
| 236 | array( |
| 237 | 'label' => __( 'Quote symbol color', 'auxin-elements' ), |
| 238 | 'type' => Controls_Manager::COLOR, |
| 239 | 'selectors' => array( |
| 240 | '{{WRAPPER}} .aux-quote-symbol:before' => 'color: {{VALUE}};' |
| 241 | ), |
| 242 | 'condition' => array( |
| 243 | 'quote_symbol' => 'yes' |
| 244 | ) |
| 245 | ) |
| 246 | ); |
| 247 | |
| 248 | $this->add_group_control( |
| 249 | Group_Control_Typography::get_type(), |
| 250 | array( |
| 251 | 'name' => 'quote_symbol_typography', |
| 252 | 'global' => [ |
| 253 | 'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 254 | ], |
| 255 | 'selector' => '{{WRAPPER}} .aux-quote-symbol:before', |
| 256 | 'condition' => array( |
| 257 | 'quote_symbol' => 'yes' |
| 258 | ) |
| 259 | ) |
| 260 | ); |
| 261 | |
| 262 | $this->add_responsive_control( |
| 263 | 'quote_text_indent', |
| 264 | array( |
| 265 | 'label' => __( 'Text indent', 'auxin-elements' ), |
| 266 | 'type' => Controls_Manager::SLIDER, |
| 267 | 'size_units' => array('px','em', 'rem'), |
| 268 | 'range' => array( |
| 269 | 'px' => array( |
| 270 | 'min' => 12, |
| 271 | 'max' => 200, |
| 272 | 'step' => 1 |
| 273 | ), |
| 274 | 'em' => array( |
| 275 | 'min' => 1, |
| 276 | 'max' => 10, |
| 277 | 'step' => 0.1 |
| 278 | ), |
| 279 | 'rem' => array( |
| 280 | 'min' => 1, |
| 281 | 'max' => 10, |
| 282 | 'step' => 0.1 |
| 283 | ) |
| 284 | ), |
| 285 | 'selectors' => array( |
| 286 | '{{WRAPPER}} .aux-quote-symbol p:first-child' => 'text-indent: {{SIZE}}{{UNIT}};' |
| 287 | ), |
| 288 | 'condition' => array( |
| 289 | 'quote_symbol' => 'yes' |
| 290 | ) |
| 291 | ) |
| 292 | ); |
| 293 | |
| 294 | $this->add_responsive_control( |
| 295 | 'quote_symbol_margin', |
| 296 | array( |
| 297 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 298 | 'type' => Controls_Manager::DIMENSIONS, |
| 299 | 'size_units' => array( 'px', 'em', '%' ), |
| 300 | 'selectors' => array( |
| 301 | '{{WRAPPER}} .aux-quote-symbol:before' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 302 | ) |
| 303 | ) |
| 304 | ); |
| 305 | |
| 306 | $this->end_controls_section(); |
| 307 | |
| 308 | /* Block Section |
| 309 | /*-------------------------------------*/ |
| 310 | |
| 311 | $this->start_controls_section( |
| 312 | 'block_style_section', |
| 313 | array( |
| 314 | 'label' => __( 'Block', 'auxin-elements' ), |
| 315 | 'tab' => Controls_Manager::TAB_STYLE |
| 316 | ) |
| 317 | ); |
| 318 | |
| 319 | $this->add_group_control( |
| 320 | Group_Control_Border::get_type(), |
| 321 | array( |
| 322 | 'name' => 'block_border', |
| 323 | 'selector' => '{{WRAPPER}} .aux-elem-quote', |
| 324 | 'separator' => 'before' |
| 325 | ) |
| 326 | ); |
| 327 | |
| 328 | $this->add_control( |
| 329 | 'blox_background_color', |
| 330 | array( |
| 331 | 'label' => __( 'Background color', 'auxin-elements' ), |
| 332 | 'type' => Controls_Manager::COLOR, |
| 333 | 'selectors' => array( |
| 334 | '{{WRAPPER}} .aux-elem-quote' => 'background-color: {{VALUE}};' |
| 335 | ) |
| 336 | ) |
| 337 | ); |
| 338 | |
| 339 | $this->add_responsive_control( |
| 340 | 'quote_symbol_padding', |
| 341 | array( |
| 342 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 343 | 'type' => Controls_Manager::DIMENSIONS, |
| 344 | 'size_units' => array( 'px', 'em', '%' ), |
| 345 | 'selectors' => array( |
| 346 | '{{WRAPPER}} .aux-blockquote-normal' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 347 | ) |
| 348 | ) |
| 349 | ); |
| 350 | |
| 351 | $this->end_controls_section(); |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * Render 'Quote' widget output on the frontend. |
| 356 | * |
| 357 | * @access protected |
| 358 | */ |
| 359 | protected function render() { |
| 360 | |
| 361 | $settings = $this->get_settings_for_display(); |
| 362 | |
| 363 | $args = array( |
| 364 | 'type' => 'blockquote-normal', //$settings['type'], |
| 365 | 'text_align' => $settings['text_align'], |
| 366 | 'quote_symbol' => $settings['quote_symbol'] |
| 367 | ); |
| 368 | |
| 369 | // pass the args through the corresponding shortcode callback |
| 370 | echo auxin_widget_quote_callback( $args, $settings['content'] ); |
| 371 | } |
| 372 | |
| 373 | } |
| 374 |