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