| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
|---|
| 4 | // Exit if accessed directly. |
|---|
| 5 | exit; |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | if ( ! function_exists( 'qi_addons_for_elementor_add_info_button_shortcode' ) ) { |
|---|
| 9 | /** |
|---|
| 10 | * Function that isadding shortcode into shortcodes list for registration |
|---|
| 11 | * |
|---|
| 12 | * @param array $shortcodes - Array of registered shortcodes |
|---|
| 13 | * |
|---|
| 14 | * @return array |
|---|
| 15 | */ |
|---|
| 16 | function qi_addons_for_elementor_add_info_button_shortcode( $shortcodes ) { |
|---|
| 17 | $shortcodes[] = 'QiAddonsForElementor_Info_Button_Shortcode'; |
|---|
| 18 | |
|---|
| 19 | return $shortcodes; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | add_filter( 'qi_addons_for_elementor_filter_register_shortcodes', 'qi_addons_for_elementor_add_info_button_shortcode', 9 ); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | if ( class_exists( 'QiAddonsForElementor_Shortcode' ) ) { |
|---|
| 26 | class QiAddonsForElementor_Info_Button_Shortcode extends QiAddonsForElementor_Shortcode { |
|---|
| 27 | |
|---|
| 28 | public function map_shortcode() { |
|---|
| 29 | $this->set_shortcode_path( QI_ADDONS_FOR_ELEMENTOR_SHORTCODES_URL_PATH . '/info-button' ); |
|---|
| 30 | $this->set_base( 'qi_addons_for_elementor_info_button' ); |
|---|
| 31 | $this->set_name( esc_html__( 'Info Button', 'qi-addons-for-elementor' ) ); |
|---|
| 32 | $this->set_description( esc_html__( 'Shortcode that displays info button with provided parameters', 'qi-addons-for-elementor' ) ); |
|---|
| 33 | $this->set_category( esc_html__( 'Qi Addons For Elementor', 'qi-addons-for-elementor' ) ); |
|---|
| 34 | $this->set_subcategory( esc_html__( 'Typography', 'qi-addons-for-elementor' ) ); |
|---|
| 35 | $this->set_demo( 'https://qodeinteractive.com/qi-addons-for-elementor/info-button/' ); |
|---|
| 36 | $this->set_documentation( 'https://qodeinteractive.com/qi-addons-for-elementor/documentation/#info_button' ); |
|---|
| 37 | $this->set_video( 'https://www.youtube.com/watch?v=JkjHNRcc2zI' ); |
|---|
| 38 | $this->set_necessary_styles( qi_addons_for_elementor_icon_necessary_styles() ); |
|---|
| 39 | |
|---|
| 40 | $this->set_option( |
|---|
| 41 | array( |
|---|
| 42 | 'field_type' => 'text', |
|---|
| 43 | 'name' => 'custom_class', |
|---|
| 44 | 'title' => esc_html__( 'Custom Class', 'qi-addons-for-elementor' ), |
|---|
| 45 | ) |
|---|
| 46 | ); |
|---|
| 47 | |
|---|
| 48 | $this->set_option( |
|---|
| 49 | array( |
|---|
| 50 | 'field_type' => 'select', |
|---|
| 51 | 'name' => 'info_button_layout', |
|---|
| 52 | 'title' => esc_html__( 'Layout', 'qi-addons-for-elementor' ), |
|---|
| 53 | 'options' => array( |
|---|
| 54 | 'filled' => esc_html__( 'Filled', 'qi-addons-for-elementor' ), |
|---|
| 55 | 'outlined' => esc_html__( 'Outlined', 'qi-addons-for-elementor' ), |
|---|
| 56 | ), |
|---|
| 57 | 'default_value' => 'filled', |
|---|
| 58 | ) |
|---|
| 59 | ); |
|---|
| 60 | $this->set_option( |
|---|
| 61 | array( |
|---|
| 62 | 'field_type' => 'select', |
|---|
| 63 | 'name' => 'info_button_type', |
|---|
| 64 | 'title' => esc_html__( 'Type', 'qi-addons-for-elementor' ), |
|---|
| 65 | 'options' => array( |
|---|
| 66 | 'standard' => esc_html__( 'Standard', 'qi-addons-for-elementor' ), |
|---|
| 67 | 'icon-boxed' => esc_html__( 'Icon Boxed', 'qi-addons-for-elementor' ), |
|---|
| 68 | ), |
|---|
| 69 | 'default_value' => 'standard', |
|---|
| 70 | ) |
|---|
| 71 | ); |
|---|
| 72 | $this->set_option( |
|---|
| 73 | array( |
|---|
| 74 | 'field_type' => 'select', |
|---|
| 75 | 'name' => 'info_button_size', |
|---|
| 76 | 'title' => esc_html__( 'Size', 'qi-addons-for-elementor' ), |
|---|
| 77 | 'options' => array( |
|---|
| 78 | '' => esc_html__( 'Normal', 'qi-addons-for-elementor' ), |
|---|
| 79 | 'small' => esc_html__( 'Small', 'qi-addons-for-elementor' ), |
|---|
| 80 | 'large' => esc_html__( 'Large', 'qi-addons-for-elementor' ), |
|---|
| 81 | 'full' => esc_html__( 'Normal Full Width', 'qi-addons-for-elementor' ), |
|---|
| 82 | ), |
|---|
| 83 | ) |
|---|
| 84 | ); |
|---|
| 85 | $this->set_option( |
|---|
| 86 | array( |
|---|
| 87 | 'field_type' => 'text', |
|---|
| 88 | 'name' => 'info_button_text', |
|---|
| 89 | 'title' => esc_html__( 'Button Text', 'qi-addons-for-elementor' ), |
|---|
| 90 | 'default_value' => esc_html__( 'Click Here', 'qi-addons-for-elementor' ), |
|---|
| 91 | ) |
|---|
| 92 | ); |
|---|
| 93 | $this->set_option( |
|---|
| 94 | array( |
|---|
| 95 | 'field_type' => 'text', |
|---|
| 96 | 'name' => 'info_button_subtext', |
|---|
| 97 | 'title' => esc_html__( 'Button Subtext', 'qi-addons-for-elementor' ), |
|---|
| 98 | 'default_value' => esc_html__( 'See More Here', 'qi-addons-for-elementor' ), |
|---|
| 99 | ) |
|---|
| 100 | ); |
|---|
| 101 | $this->set_option( |
|---|
| 102 | array( |
|---|
| 103 | 'field_type' => 'link', |
|---|
| 104 | 'name' => 'info_button_link', |
|---|
| 105 | 'title' => esc_html__( 'Button Link', 'qi-addons-for-elementor' ), |
|---|
| 106 | ) |
|---|
| 107 | ); |
|---|
| 108 | $this->set_option( |
|---|
| 109 | array( |
|---|
| 110 | 'field_type' => 'typography', |
|---|
| 111 | 'name' => 'info_button_typography', |
|---|
| 112 | 'title' => esc_html__( 'Typography', 'qi-addons-for-elementor' ), |
|---|
| 113 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 114 | 'selector' => '{{WRAPPER}} .qodef-qi-info-button', |
|---|
| 115 | ) |
|---|
| 116 | ); |
|---|
| 117 | $this->set_option( |
|---|
| 118 | array( |
|---|
| 119 | 'field_type' => 'typography', |
|---|
| 120 | 'name' => 'info_button_subtext_typography', |
|---|
| 121 | 'title' => esc_html__( 'Subtext Typography', 'qi-addons-for-elementor' ), |
|---|
| 122 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 123 | 'selector' => '{{WRAPPER}} .qodef-m-subtext', |
|---|
| 124 | ) |
|---|
| 125 | ); |
|---|
| 126 | $this->set_option( |
|---|
| 127 | array( |
|---|
| 128 | 'field_type' => 'start_controls_tabs', |
|---|
| 129 | 'name' => 'info_button_style_tabs', |
|---|
| 130 | 'title' => esc_html__( 'Tabs Start', 'qi-addons-for-elementor' ), |
|---|
| 131 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 132 | ) |
|---|
| 133 | ); |
|---|
| 134 | |
|---|
| 135 | $this->set_option( |
|---|
| 136 | array( |
|---|
| 137 | 'field_type' => 'start_controls_tab', |
|---|
| 138 | 'name' => 'info_button_tab_normal', |
|---|
| 139 | 'title' => esc_html__( 'Normal', 'qi-addons-for-elementor' ), |
|---|
| 140 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 141 | ) |
|---|
| 142 | ); |
|---|
| 143 | $this->set_option( |
|---|
| 144 | array( |
|---|
| 145 | 'field_type' => 'color', |
|---|
| 146 | 'name' => 'info_button_color', |
|---|
| 147 | 'title' => esc_html__( 'Text Color', 'qi-addons-for-elementor' ), |
|---|
| 148 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 149 | 'selectors' => array( |
|---|
| 150 | '{{WRAPPER}} .qodef-qi-info-button' => 'color: {{VALUE}};', |
|---|
| 151 | ), |
|---|
| 152 | ) |
|---|
| 153 | ); |
|---|
| 154 | $this->set_option( |
|---|
| 155 | array( |
|---|
| 156 | 'field_type' => 'color', |
|---|
| 157 | 'name' => 'info_button_subtext_color', |
|---|
| 158 | 'title' => esc_html__( 'Subtext Color', 'qi-addons-for-elementor' ), |
|---|
| 159 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 160 | 'selectors' => array( |
|---|
| 161 | '{{WRAPPER}} .qodef-m-subtext' => 'color: {{VALUE}};', |
|---|
| 162 | ), |
|---|
| 163 | ) |
|---|
| 164 | ); |
|---|
| 165 | $this->set_option( |
|---|
| 166 | array( |
|---|
| 167 | 'field_type' => 'color', |
|---|
| 168 | 'name' => 'info_button_background_color', |
|---|
| 169 | 'title' => esc_html__( 'Background Color', 'qi-addons-for-elementor' ), |
|---|
| 170 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 171 | 'selectors' => array( |
|---|
| 172 | '{{WRAPPER}} .qodef-qi-info-button.qodef-layout--filled' => 'background-color: {{VALUE}};', |
|---|
| 173 | ), |
|---|
| 174 | ) |
|---|
| 175 | ); |
|---|
| 176 | $this->set_option( |
|---|
| 177 | array( |
|---|
| 178 | 'field_type' => 'color', |
|---|
| 179 | 'name' => 'info_button_border_color', |
|---|
| 180 | 'title' => esc_html__( 'Border Color', 'qi-addons-for-elementor' ), |
|---|
| 181 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 182 | 'selectors' => array( |
|---|
| 183 | '{{WRAPPER}} .qodef-qi-info-button' => 'border-color: {{VALUE}};', |
|---|
| 184 | ), |
|---|
| 185 | ) |
|---|
| 186 | ); |
|---|
| 187 | $this->set_option( |
|---|
| 188 | array( |
|---|
| 189 | 'field_type' => 'end_controls_tab', |
|---|
| 190 | 'name' => 'info_button_tab_normal_end', |
|---|
| 191 | 'title' => esc_html__( 'Normal End', 'qi-addons-for-elementor' ), |
|---|
| 192 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 193 | ) |
|---|
| 194 | ); |
|---|
| 195 | $this->set_option( |
|---|
| 196 | array( |
|---|
| 197 | 'field_type' => 'start_controls_tab', |
|---|
| 198 | 'name' => 'info_button_tab_hover', |
|---|
| 199 | 'title' => esc_html__( 'Hover', 'qi-addons-for-elementor' ), |
|---|
| 200 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 201 | ) |
|---|
| 202 | ); |
|---|
| 203 | $this->set_option( |
|---|
| 204 | array( |
|---|
| 205 | 'field_type' => 'color', |
|---|
| 206 | 'name' => 'info_button_hover_color', |
|---|
| 207 | 'title' => esc_html__( 'Text Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 208 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 209 | 'selectors' => array( |
|---|
| 210 | '{{WRAPPER}} .qodef-qi-info-button:hover' => 'color: {{VALUE}};', |
|---|
| 211 | ), |
|---|
| 212 | ) |
|---|
| 213 | ); |
|---|
| 214 | $this->set_option( |
|---|
| 215 | array( |
|---|
| 216 | 'field_type' => 'color', |
|---|
| 217 | 'name' => 'info_button_subtext_hover_color', |
|---|
| 218 | 'title' => esc_html__( 'Subtext Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 219 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 220 | 'selectors' => array( |
|---|
| 221 | '{{WRAPPER}} .qodef-qi-info-button:hover .qodef-m-subtext' => 'color: {{VALUE}};', |
|---|
| 222 | ), |
|---|
| 223 | 'dependency' => array( |
|---|
| 224 | 'hide' => array( |
|---|
| 225 | 'info_button_subtext_color' => array( |
|---|
| 226 | 'values' => '', |
|---|
| 227 | 'default_value' => '', |
|---|
| 228 | ), |
|---|
| 229 | ), |
|---|
| 230 | ), |
|---|
| 231 | ) |
|---|
| 232 | ); |
|---|
| 233 | $this->set_option( |
|---|
| 234 | array( |
|---|
| 235 | 'field_type' => 'color', |
|---|
| 236 | 'name' => 'info_button_hover_background_color', |
|---|
| 237 | 'title' => esc_html__( 'Background Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 238 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 239 | 'selectors' => array( |
|---|
| 240 | '{{WRAPPER}} .qodef-qi-info-button.qodef-layout--filled:hover' => 'background-color: {{VALUE}};', |
|---|
| 241 | '{{WRAPPER}} .qodef-qi-info-button.qodef-layout--outlined:hover' => 'background-color: {{VALUE}};', |
|---|
| 242 | ), |
|---|
| 243 | ) |
|---|
| 244 | ); |
|---|
| 245 | $this->set_option( |
|---|
| 246 | array( |
|---|
| 247 | 'field_type' => 'color', |
|---|
| 248 | 'name' => 'info_button_hover_border_color', |
|---|
| 249 | 'title' => esc_html__( 'Border Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 250 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 251 | 'selectors' => array( |
|---|
| 252 | '{{WRAPPER}} .qodef-qi-info-button:hover' => 'border-color: {{VALUE}};', |
|---|
| 253 | ), |
|---|
| 254 | ) |
|---|
| 255 | ); |
|---|
| 256 | $this->set_option( |
|---|
| 257 | array( |
|---|
| 258 | 'field_type' => 'end_controls_tab', |
|---|
| 259 | 'name' => 'info_button_tab_hover_end', |
|---|
| 260 | 'title' => esc_html__( 'Hover End', 'qi-addons-for-elementor' ), |
|---|
| 261 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 262 | ) |
|---|
| 263 | ); |
|---|
| 264 | $this->set_option( |
|---|
| 265 | array( |
|---|
| 266 | 'field_type' => 'end_controls_tabs', |
|---|
| 267 | 'name' => 'info_button_style_tabs_end', |
|---|
| 268 | 'title' => esc_html__( 'Tabs End', 'qi-addons-for-elementor' ), |
|---|
| 269 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 270 | ) |
|---|
| 271 | ); |
|---|
| 272 | $this->set_option( |
|---|
| 273 | array( |
|---|
| 274 | 'field_type' => 'divider', |
|---|
| 275 | 'name' => 'item_divider_info_button_tab_style', |
|---|
| 276 | 'title' => esc_html__( 'Divider', 'qi-addons-for-elementor' ), |
|---|
| 277 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 278 | ) |
|---|
| 279 | ); |
|---|
| 280 | $this->set_option( |
|---|
| 281 | array( |
|---|
| 282 | 'field_type' => 'dimensions', |
|---|
| 283 | 'name' => 'info_button_border_width', |
|---|
| 284 | 'title' => esc_html__( 'Border Width', 'qi-addons-for-elementor' ), |
|---|
| 285 | 'responsive' => true, |
|---|
| 286 | 'selectors' => array( |
|---|
| 287 | '{{WRAPPER}} .qodef-qi-info-button' => 'border-width: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
|---|
| 288 | ), |
|---|
| 289 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 290 | ) |
|---|
| 291 | ); |
|---|
| 292 | $this->set_option( |
|---|
| 293 | array( |
|---|
| 294 | 'field_type' => 'dimensions', |
|---|
| 295 | 'name' => 'info_button_border_radius', |
|---|
| 296 | 'title' => esc_html__( 'Border Radius', 'qi-addons-for-elementor' ), |
|---|
| 297 | 'size_units' => array( 'px', '%' ), |
|---|
| 298 | 'responsive' => true, |
|---|
| 299 | 'selectors' => array( |
|---|
| 300 | '{{WRAPPER}} .qodef-qi-info-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
|---|
| 301 | ), |
|---|
| 302 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 303 | ) |
|---|
| 304 | ); |
|---|
| 305 | $this->set_option( |
|---|
| 306 | array( |
|---|
| 307 | 'field_type' => 'dimensions', |
|---|
| 308 | 'name' => 'info_button_padding', |
|---|
| 309 | 'title' => esc_html__( 'Padding', 'qi-addons-for-elementor' ), |
|---|
| 310 | 'size_units' => array( 'px', '%', 'em' ), |
|---|
| 311 | 'responsive' => true, |
|---|
| 312 | 'selectors' => array( |
|---|
| 313 | '{{WRAPPER}} .qodef-qi-info-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
|---|
| 314 | '{{WRAPPER}} .qodef-qi-info-button.qodef-type--icon-boxed .qodef-m-text-holder' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
|---|
| 315 | '{{WRAPPER}} .qodef-qi-info-button.qodef-type--icon-boxed .qodef-m-icon' => 'padding: {{TOP}}{{UNIT}} 0 {{BOTTOM}}{{UNIT}};', |
|---|
| 316 | ), |
|---|
| 317 | 'group' => esc_html__( 'Style', 'qi-addons-for-elementor' ), |
|---|
| 318 | ) |
|---|
| 319 | ); |
|---|
| 320 | |
|---|
| 321 | // Icon options. |
|---|
| 322 | $this->set_option( |
|---|
| 323 | array( |
|---|
| 324 | 'field_type' => 'icons', |
|---|
| 325 | 'name' => 'info_button_icon', |
|---|
| 326 | 'title' => esc_html__( 'Icon', 'qi-addons-for-elementor' ), |
|---|
| 327 | 'group' => esc_html__( 'Icon', 'qi-addons-for-elementor' ), |
|---|
| 328 | ) |
|---|
| 329 | ); |
|---|
| 330 | |
|---|
| 331 | $this->set_option( |
|---|
| 332 | array( |
|---|
| 333 | 'field_type' => 'select', |
|---|
| 334 | 'name' => 'info_button_icon_position', |
|---|
| 335 | 'title' => esc_html__( 'Icon Position', 'qi-addons-for-elementor' ), |
|---|
| 336 | 'options' => array( |
|---|
| 337 | 'left' => esc_html__( 'Left', 'qi-addons-for-elementor' ), |
|---|
| 338 | 'right' => esc_html__( 'Right', 'qi-addons-for-elementor' ), |
|---|
| 339 | ), |
|---|
| 340 | 'default_value' => 'right', |
|---|
| 341 | 'group' => esc_html__( 'Icon', 'qi-addons-for-elementor' ), |
|---|
| 342 | ) |
|---|
| 343 | ); |
|---|
| 344 | |
|---|
| 345 | $this->set_option( |
|---|
| 346 | array( |
|---|
| 347 | 'field_type' => 'slider', |
|---|
| 348 | 'name' => 'info_button_icon_size', |
|---|
| 349 | 'title' => esc_html__( 'Icon Size', 'qi-addons-for-elementor' ), |
|---|
| 350 | 'size_units' => array( 'px', 'em', 'rem', 'vw' ), |
|---|
| 351 | 'responsive' => true, |
|---|
| 352 | 'selectors' => array( |
|---|
| 353 | '{{WRAPPER}} .qodef-m-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
|---|
| 354 | ), |
|---|
| 355 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 356 | ) |
|---|
| 357 | ); |
|---|
| 358 | |
|---|
| 359 | $this->set_option( |
|---|
| 360 | array( |
|---|
| 361 | 'field_type' => 'start_controls_tabs', |
|---|
| 362 | 'name' => 'info_button_icon_style_tabs', |
|---|
| 363 | 'title' => esc_html__( 'Tabs Start', 'qi-addons-for-elementor' ), |
|---|
| 364 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 365 | ) |
|---|
| 366 | ); |
|---|
| 367 | |
|---|
| 368 | $this->set_option( |
|---|
| 369 | array( |
|---|
| 370 | 'field_type' => 'start_controls_tab', |
|---|
| 371 | 'name' => 'info_button_icon_tab_normal', |
|---|
| 372 | 'title' => esc_html__( 'Normal', 'qi-addons-for-elementor' ), |
|---|
| 373 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 374 | ) |
|---|
| 375 | ); |
|---|
| 376 | |
|---|
| 377 | $this->set_option( |
|---|
| 378 | array( |
|---|
| 379 | 'field_type' => 'color', |
|---|
| 380 | 'name' => 'info_button_icon_color', |
|---|
| 381 | 'title' => esc_html__( 'Icon Color', 'qi-addons-for-elementor' ), |
|---|
| 382 | 'selectors' => array( |
|---|
| 383 | '{{WRAPPER}} .qodef-m-icon' => 'color: {{VALUE}};', |
|---|
| 384 | ), |
|---|
| 385 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 386 | ) |
|---|
| 387 | ); |
|---|
| 388 | |
|---|
| 389 | // Icon Background Options (only for icon boxed, when filled and outline layout is chosen). |
|---|
| 390 | $this->set_option( |
|---|
| 391 | array( |
|---|
| 392 | 'field_type' => 'color', |
|---|
| 393 | 'name' => 'info_button_icon_background_color', |
|---|
| 394 | 'title' => esc_html__( 'Icon Background Color', 'qi-addons-for-elementor' ), |
|---|
| 395 | 'selectors' => array( |
|---|
| 396 | '{{WRAPPER}} .qodef-qi-info-button.qodef-type--icon-boxed .qodef-m-icon' => 'background-color: {{VALUE}};', |
|---|
| 397 | ), |
|---|
| 398 | 'dependency' => array( |
|---|
| 399 | 'show' => array( |
|---|
| 400 | 'info_button_type' => array( |
|---|
| 401 | 'values' => 'icon-boxed', |
|---|
| 402 | 'default_value' => 'standard', |
|---|
| 403 | ), |
|---|
| 404 | ), |
|---|
| 405 | ), |
|---|
| 406 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 407 | ) |
|---|
| 408 | ); |
|---|
| 409 | |
|---|
| 410 | $this->set_option( |
|---|
| 411 | array( |
|---|
| 412 | 'field_type' => 'end_controls_tab', |
|---|
| 413 | 'name' => 'info_button_tab_icon_normal_end', |
|---|
| 414 | 'title' => esc_html__( 'Normal End', 'qi-addons-for-elementor' ), |
|---|
| 415 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 416 | ) |
|---|
| 417 | ); |
|---|
| 418 | |
|---|
| 419 | $this->set_option( |
|---|
| 420 | array( |
|---|
| 421 | 'field_type' => 'start_controls_tab', |
|---|
| 422 | 'name' => 'info_button_icon_tab_hover', |
|---|
| 423 | 'title' => esc_html__( 'Hover', 'qi-addons-for-elementor' ), |
|---|
| 424 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 425 | ) |
|---|
| 426 | ); |
|---|
| 427 | |
|---|
| 428 | $this->set_option( |
|---|
| 429 | array( |
|---|
| 430 | 'field_type' => 'color', |
|---|
| 431 | 'name' => 'info_button_icon_hover_color', |
|---|
| 432 | 'title' => esc_html__( 'Icon Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 433 | 'selectors' => array( |
|---|
| 434 | '{{WRAPPER}} .qodef-qi-info-button:hover .qodef-m-icon' => 'color: {{VALUE}};', |
|---|
| 435 | ), |
|---|
| 436 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 437 | 'dependency' => array( |
|---|
| 438 | 'hide' => array( |
|---|
| 439 | 'info_button_icon_color' => array( |
|---|
| 440 | 'values' => '', |
|---|
| 441 | 'default_value' => '', |
|---|
| 442 | ), |
|---|
| 443 | ), |
|---|
| 444 | ), |
|---|
| 445 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 446 | ) |
|---|
| 447 | ); |
|---|
| 448 | |
|---|
| 449 | $this->set_option( |
|---|
| 450 | array( |
|---|
| 451 | 'field_type' => 'color', |
|---|
| 452 | 'name' => 'info_button_icon_background_hover_color', |
|---|
| 453 | 'title' => esc_html__( 'Icon Background Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 454 | 'selectors' => array( |
|---|
| 455 | '{{WRAPPER}} .qodef-qi-info-button.qodef-type--icon-boxed:hover .qodef-m-icon' => 'background-color: {{VALUE}};', |
|---|
| 456 | ), |
|---|
| 457 | 'dependency' => array( |
|---|
| 458 | 'show' => array( |
|---|
| 459 | 'info_button_type' => array( |
|---|
| 460 | 'values' => 'icon-boxed', |
|---|
| 461 | 'default_value' => 'standard', |
|---|
| 462 | ), |
|---|
| 463 | ), |
|---|
| 464 | ), |
|---|
| 465 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 466 | ) |
|---|
| 467 | ); |
|---|
| 468 | |
|---|
| 469 | $this->set_option( |
|---|
| 470 | array( |
|---|
| 471 | 'field_type' => 'select', |
|---|
| 472 | 'name' => 'info_button_icon_hover_move', |
|---|
| 473 | 'title' => esc_html__( 'Move Icon', 'qi-addons-for-elementor' ), |
|---|
| 474 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 475 | 'options' => array( |
|---|
| 476 | 'move-horizontal-short' => esc_html__( 'Horizontal Short', 'qi-addons-for-elementor' ), |
|---|
| 477 | 'move-horizontal' => esc_html__( 'Horizontal', 'qi-addons-for-elementor' ), |
|---|
| 478 | 'move-vertical' => esc_html__( 'Vertical', 'qi-addons-for-elementor' ), |
|---|
| 479 | 'move-diagonal' => esc_html__( 'Diagonal', 'qi-addons-for-elementor' ), |
|---|
| 480 | '' => esc_html__( 'None', 'qi-addons-for-elementor' ), |
|---|
| 481 | ), |
|---|
| 482 | ) |
|---|
| 483 | ); |
|---|
| 484 | |
|---|
| 485 | $this->set_option( |
|---|
| 486 | array( |
|---|
| 487 | 'field_type' => 'end_controls_tab', |
|---|
| 488 | 'name' => 'info_button_icon_tab_hover_end', |
|---|
| 489 | 'title' => esc_html__( 'Hover End', 'qi-addons-for-elementor' ), |
|---|
| 490 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 491 | ) |
|---|
| 492 | ); |
|---|
| 493 | $this->set_option( |
|---|
| 494 | array( |
|---|
| 495 | 'field_type' => 'end_controls_tabs', |
|---|
| 496 | 'name' => 'info_button_icon_style_tabs_end', |
|---|
| 497 | 'title' => esc_html__( 'Tabs End', 'qi-addons-for-elementor' ), |
|---|
| 498 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 499 | ) |
|---|
| 500 | ); |
|---|
| 501 | |
|---|
| 502 | $this->set_option( |
|---|
| 503 | array( |
|---|
| 504 | 'field_type' => 'divider', |
|---|
| 505 | 'name' => 'info_button_icon_margin_divider', |
|---|
| 506 | 'title' => esc_html__( 'Icon Divider', 'qi-addons-for-elementor' ), |
|---|
| 507 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 508 | ) |
|---|
| 509 | ); |
|---|
| 510 | |
|---|
| 511 | $this->set_option( |
|---|
| 512 | array( |
|---|
| 513 | 'field_type' => 'dimensions', |
|---|
| 514 | 'name' => 'info_button_icon_margin', |
|---|
| 515 | 'title' => esc_html__( 'Icon Margin', 'qi-addons-for-elementor' ), |
|---|
| 516 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 517 | 'size_units' => array( 'px', '%', 'em' ), |
|---|
| 518 | 'allowed_dimensions' => array( 'left', 'right' ), |
|---|
| 519 | 'responsive' => true, |
|---|
| 520 | 'selectors' => array( |
|---|
| 521 | '{{WRAPPER}} .qodef-m-icon' => 'margin: 0 {{RIGHT}}{{UNIT}} 0 {{LEFT}}{{UNIT}};', |
|---|
| 522 | ), |
|---|
| 523 | ) |
|---|
| 524 | ); |
|---|
| 525 | |
|---|
| 526 | $this->set_option( |
|---|
| 527 | array( |
|---|
| 528 | 'field_type' => 'divider', |
|---|
| 529 | 'name' => 'info_button_icon_border_divider', |
|---|
| 530 | 'title' => esc_html__( 'Icon Divider', 'qi-addons-for-elementor' ), |
|---|
| 531 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 532 | ) |
|---|
| 533 | ); |
|---|
| 534 | |
|---|
| 535 | // Icon Side Border Options (only for icon boxed, when filled and outline layout is chosen). |
|---|
| 536 | $this->set_option( |
|---|
| 537 | array( |
|---|
| 538 | 'field_type' => 'select', |
|---|
| 539 | 'name' => 'info_button_icon_enable_side_border', |
|---|
| 540 | 'title' => esc_html__( 'Enable Icon Side Border', 'qi-addons-for-elementor' ), |
|---|
| 541 | 'options' => qi_addons_for_elementor_get_select_type_options_pool( 'no_yes', false ), |
|---|
| 542 | 'default_value' => 'no', |
|---|
| 543 | 'dependency' => array( |
|---|
| 544 | 'show' => array( |
|---|
| 545 | 'info_button_type' => array( |
|---|
| 546 | 'values' => 'icon-boxed', |
|---|
| 547 | 'default_value' => 'standard', |
|---|
| 548 | ), |
|---|
| 549 | ), |
|---|
| 550 | ), |
|---|
| 551 | 'group' => esc_html__( 'Icon', 'qi-addons-for-elementor' ), |
|---|
| 552 | ) |
|---|
| 553 | ); |
|---|
| 554 | |
|---|
| 555 | $this->set_option( |
|---|
| 556 | array( |
|---|
| 557 | 'field_type' => 'color', |
|---|
| 558 | 'name' => 'info_button_icon_side_color', |
|---|
| 559 | 'title' => esc_html__( 'Icon Side Border Color', 'qi-addons-for-elementor' ), |
|---|
| 560 | 'selectors' => array( |
|---|
| 561 | '{{WRAPPER}} .qodef-m-border' => 'background-color: {{VALUE}};', |
|---|
| 562 | ), |
|---|
| 563 | 'dependency' => array( |
|---|
| 564 | 'show' => array( |
|---|
| 565 | 'info_button_icon_enable_side_border' => array( |
|---|
| 566 | 'values' => 'yes', |
|---|
| 567 | 'default_value' => 'no', |
|---|
| 568 | ), |
|---|
| 569 | ), |
|---|
| 570 | ), |
|---|
| 571 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 572 | ) |
|---|
| 573 | ); |
|---|
| 574 | |
|---|
| 575 | $this->set_option( |
|---|
| 576 | array( |
|---|
| 577 | 'field_type' => 'color', |
|---|
| 578 | 'name' => 'info_button_icon_side_hover_color', |
|---|
| 579 | 'title' => esc_html__( 'Icon Side Border Hover Color', 'qi-addons-for-elementor' ), |
|---|
| 580 | 'selectors' => array( |
|---|
| 581 | '{{WRAPPER}} .qodef-qi-info-button.qodef-type--icon-boxed:hover .qodef-m-border' => 'background-color: {{VALUE}};', |
|---|
| 582 | ), |
|---|
| 583 | 'dependency' => array( |
|---|
| 584 | 'show' => array( |
|---|
| 585 | 'info_button_icon_enable_side_border' => array( |
|---|
| 586 | 'values' => 'yes', |
|---|
| 587 | 'default_value' => 'no', |
|---|
| 588 | ), |
|---|
| 589 | ), |
|---|
| 590 | ), |
|---|
| 591 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 592 | ) |
|---|
| 593 | ); |
|---|
| 594 | |
|---|
| 595 | $this->set_option( |
|---|
| 596 | array( |
|---|
| 597 | 'field_type' => 'slider', |
|---|
| 598 | 'name' => 'info_button_icon_side_height', |
|---|
| 599 | 'title' => esc_html__( 'Icon Side Border Height', 'qi-addons-for-elementor' ), |
|---|
| 600 | 'size_units' => array( 'px' ), |
|---|
| 601 | 'responsive' => true, |
|---|
| 602 | 'selectors' => array( |
|---|
| 603 | '{{WRAPPER}} .qodef-m-border' => 'height: {{SIZE}}{{UNIT}}; align-self: center;', |
|---|
| 604 | ), |
|---|
| 605 | 'dependency' => array( |
|---|
| 606 | 'show' => array( |
|---|
| 607 | 'info_button_icon_enable_side_border' => array( |
|---|
| 608 | 'values' => 'yes', |
|---|
| 609 | 'default_value' => 'no', |
|---|
| 610 | ), |
|---|
| 611 | ), |
|---|
| 612 | ), |
|---|
| 613 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 614 | ) |
|---|
| 615 | ); |
|---|
| 616 | $this->set_option( |
|---|
| 617 | array( |
|---|
| 618 | 'field_type' => 'slider', |
|---|
| 619 | 'name' => 'info_button_icon_side_width', |
|---|
| 620 | 'title' => esc_html__( 'Icon Side Border Width', 'qi-addons-for-elementor' ), |
|---|
| 621 | 'size_units' => array( 'px' ), |
|---|
| 622 | 'responsive' => true, |
|---|
| 623 | 'range' => array( |
|---|
| 624 | 'px' => array( |
|---|
| 625 | 'min' => 0, |
|---|
| 626 | 'max' => 10, |
|---|
| 627 | ), |
|---|
| 628 | ), |
|---|
| 629 | 'selectors' => array( |
|---|
| 630 | '{{WRAPPER}} .qodef-m-border' => 'width: {{SIZE}}{{UNIT}};', |
|---|
| 631 | ), |
|---|
| 632 | 'dependency' => array( |
|---|
| 633 | 'show' => array( |
|---|
| 634 | 'info_button_icon_enable_side_border' => array( |
|---|
| 635 | 'values' => 'yes', |
|---|
| 636 | 'default_value' => 'no', |
|---|
| 637 | ), |
|---|
| 638 | ), |
|---|
| 639 | ), |
|---|
| 640 | 'group' => esc_html__( 'Icon Style', 'qi-addons-for-elementor' ), |
|---|
| 641 | ) |
|---|
| 642 | ); |
|---|
| 643 | |
|---|
| 644 | $this->set_option( |
|---|
| 645 | array( |
|---|
| 646 | 'field_type' => 'array', |
|---|
| 647 | 'name' => 'custom_attrs', |
|---|
| 648 | 'title' => esc_html__( 'Custom Data Attributes', 'qi-addons-for-elementor' ), |
|---|
| 649 | 'visibility' => array( |
|---|
| 650 | 'map_for_page_builder' => false, |
|---|
| 651 | ), |
|---|
| 652 | ) |
|---|
| 653 | ); |
|---|
| 654 | } |
|---|
| 655 | |
|---|
| 656 | public function load_assets() { |
|---|
| 657 | parent::load_assets(); |
|---|
| 658 | |
|---|
| 659 | qi_addons_for_elementor_icon_load_assets(); |
|---|
| 660 | } |
|---|
| 661 | |
|---|
| 662 | public static function call_shortcode( $params ) { |
|---|
| 663 | $html = qi_addons_for_elementor_framework_call_shortcode( 'qi_addons_for_elementor_info_button', $params ); |
|---|
| 664 | $html = str_replace( "\n", '', $html ); |
|---|
| 665 | |
|---|
| 666 | return $html; |
|---|
| 667 | } |
|---|
| 668 | |
|---|
| 669 | public function render( $options, $content = null ) { |
|---|
| 670 | |
|---|
| 671 | parent::render( $options ); |
|---|
| 672 | $atts = $this->get_atts(); |
|---|
| 673 | |
|---|
| 674 | $atts['holder_classes'] = $this->get_holder_classes( $atts ); |
|---|
| 675 | $atts['data_attrs'] = $this->get_data_attrs( $atts ); |
|---|
| 676 | $atts['icon_classes'] = $this->get_icon_classes( $atts ); |
|---|
| 677 | $atts['subtext_classes'] = $this->get_subtext_classes( $atts ); |
|---|
| 678 | |
|---|
| 679 | return qi_addons_for_elementor_get_template_part( 'shortcodes/info-button', 'variations/' . $atts['info_button_type'] . '/templates/button', '', $atts ); |
|---|
| 680 | } |
|---|
| 681 | |
|---|
| 682 | private function get_holder_classes( $atts ) { |
|---|
| 683 | $holder_classes = $this->init_holder_classes(); |
|---|
| 684 | |
|---|
| 685 | $holder_classes[] = 'qodef-qi-info-button'; |
|---|
| 686 | $holder_classes[] = 'qodef-html--link'; |
|---|
| 687 | $holder_classes[] = ! empty( $atts['info_button_layout'] ) ? 'qodef-layout--' . $atts['info_button_layout'] : ''; |
|---|
| 688 | $holder_classes[] = ! empty( $atts['info_button_type'] ) ? 'qodef-type--' . $atts['info_button_type'] : ''; |
|---|
| 689 | $holder_classes[] = ! empty( $atts['info_button_size'] ) ? 'qodef-size--' . $atts['info_button_size'] : ''; |
|---|
| 690 | $holder_classes[] = ! empty( $atts['info_button_icon_position'] ) ? 'qodef-icon--' . $atts['info_button_icon_position'] : ''; |
|---|
| 691 | $holder_classes[] = ! empty( $atts['info_button_icon_hover_move'] ) ? 'qodef-hover--icon-' . $atts['info_button_icon_hover_move'] : ''; |
|---|
| 692 | |
|---|
| 693 | return implode( ' ', $holder_classes ); |
|---|
| 694 | } |
|---|
| 695 | |
|---|
| 696 | private function get_data_attrs( $atts ) { |
|---|
| 697 | $data = qi_addons_for_elementor_get_link_attributes( $atts['info_button_link'] ); |
|---|
| 698 | |
|---|
| 699 | if ( ! empty( $atts['custom_attrs'] ) && is_array( $atts['custom_attrs'] ) ) { |
|---|
| 700 | $data = array_merge( $data, $atts['custom_attrs'] ); |
|---|
| 701 | } |
|---|
| 702 | |
|---|
| 703 | return $data; |
|---|
| 704 | } |
|---|
| 705 | |
|---|
| 706 | private function get_icon_classes( $atts ) { |
|---|
| 707 | $icon_classes[] = 'qodef-m-icon'; |
|---|
| 708 | $icon_classes[] = ! empty( $atts['info_button_icon_color'] ) ? 'qodef--icon-color-set' : ''; |
|---|
| 709 | |
|---|
| 710 | return implode( ' ', $icon_classes ); |
|---|
| 711 | } |
|---|
| 712 | |
|---|
| 713 | private function get_subtext_classes( $atts ) { |
|---|
| 714 | $icon_classes[] = 'qodef-m-subtext'; |
|---|
| 715 | $icon_classes[] = ! empty( $atts['info_button_subtext_color'] ) ? 'qodef--subtext-color-set' : ''; |
|---|
| 716 | |
|---|
| 717 | return implode( ' ', $icon_classes ); |
|---|
| 718 | } |
|---|
| 719 | } |
|---|
| 720 | } |
|---|