@@ -35,15 +35,18 @@ function init() {
3535 'bg_overlay_color ' ,
3636 'text_overlay_color ' ,
3737 'text_border_radius ' ,
38+ 'use_heading_bg_image ' ,
39+ 'heading_bg_image ' ,
3840 );
3941
4042 $ this ->fields_defaults = array (
41- 'button_link ' => array ( '# ' ),
42- 'background_position ' => array ( 'default ' ),
43- 'background_size ' => array ( 'default ' ),
44- 'background_color ' => array ( '#ffffff ' , 'only_default_setting ' ),
45- 'alignment ' => array ( 'center ' ),
46- 'allow_player_pause ' => array ( 'off ' ),
43+ 'button_link ' => array ( '# ' ),
44+ 'background_position ' => array ( 'default ' ),
45+ 'background_size ' => array ( 'default ' ),
46+ 'background_color ' => array ( '#ffffff ' , 'only_default_setting ' ),
47+ 'alignment ' => array ( 'center ' ),
48+ 'allow_player_pause ' => array ( 'off ' ),
49+ 'use_heading_bg_image ' => array ( 'off ' ),
4750 );
4851
4952 $ this ->advanced_setting_title_text = esc_html__ ( 'New Slide ' , 'tm_builder ' );
@@ -244,6 +247,28 @@ function get_fields() {
244247 'depends_show_if ' => 'on ' ,
245248 'description ' => esc_html__ ( 'Use the color picker to choose a color for the text overlay. ' , 'tm_builder ' ),
246249 ),
250+ 'use_heading_bg_image ' => array (
251+ 'label ' => esc_html__ ( 'Use heading background image ' , 'tm_builder ' ),
252+ 'type ' => 'yes_no_button ' ,
253+ 'option_category ' => 'configuration ' ,
254+ 'options ' => array (
255+ 'off ' => esc_html__ ( 'No ' , 'tm_builder ' ),
256+ 'on ' => esc_html__ ( 'yes ' , 'tm_builder ' ),
257+ ),
258+ 'affects ' => array (
259+ '#tm_pb_heading_bg_image ' ,
260+ ),
261+ 'description ' => esc_html__ ( 'When enabled, a background color is added behind the slider text to make it more readable atop background images. ' , 'tm_builder ' ),
262+ ),
263+ 'heading_bg_image ' => array (
264+ 'label ' => esc_html__ ( 'Heading background Image ' , 'tm_builder ' ),
265+ 'type ' => 'upload ' ,
266+ 'option_category ' => 'basic_option ' ,
267+ 'upload_button_text ' => esc_attr__ ( 'Upload an image ' , 'tm_builder ' ),
268+ 'choose_text ' => esc_attr__ ( 'Choose a Heading Background Image ' , 'tm_builder ' ),
269+ 'update_text ' => esc_attr__ ( 'Set As Heading Background ' , 'tm_builder ' ),
270+ 'description ' => esc_html__ ( 'If defined, this image will be used as the background for this module. To remove a Heading background image, simply delete the URL from the settings field. ' , 'tm_builder ' ),
271+ ),
247272 'alignment ' => array (
248273 'label ' => esc_html__ ( 'Slide Image Vertical Alignment ' , 'tm_builder ' ),
249274 'type ' => 'select ' ,
@@ -380,6 +405,8 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
380405 'use_text_overlay ' ,
381406 'text_overlay_color ' ,
382407 'text_border_radius ' ,
408+ 'use_heading_bg_image ' ,
409+ 'heading_bg_image ' ,
383410 )
384411 );
385412
@@ -515,7 +542,8 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
515542 ) );
516543 }
517544
518- if ( 'on ' === $ this ->_var ( 'use_text_overlay ' ) && '' !== $ this ->_var ( 'text_overlay_color ' ) ) { TM_Builder_Element::set_style ( $ function_name , array (
545+ if ( 'on ' === $ this ->_var ( 'use_text_overlay ' ) && '' !== $ this ->_var ( 'text_overlay_color ' ) ) {
546+ TM_Builder_Element::set_style ( $ function_name , array (
519547 'selector ' => '%%order_class%%.tm_pb_slide .tm_pb_slide_description_inner ' ,
520548 'declaration ' => sprintf (
521549 'background-color: %1$s; ' ,
@@ -553,6 +581,20 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
553581 ) );
554582 }
555583
584+ if ( 'on ' === $ this ->_var ( 'use_heading_bg_image ' ) && '' !== $ this ->_var ( 'heading_bg_image ' ) ) {
585+ TM_Builder_Element::set_style ( $ function_name , array (
586+ 'selector ' => '%%order_class%%.tm_pb_slide .tm_pb_slide_title ' ,
587+ 'declaration ' => sprintf (
588+ 'background: url( %1$s ) center;
589+ -webkit-background-clip: text;
590+ -moz-background-clip: text;
591+ background-clip: text; ' ,
592+ esc_url ( $ this ->_var ( 'heading_bg_image ' ) )
593+ ),
594+ ) );
595+ }
596+
597+
556598 $ style = '' !== $ style ? " style=' {$ style }' " : '' ;
557599 $ this ->_var ( 'style ' , $ style );
558600
@@ -648,18 +690,19 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
648690 %8$s
649691 %12$s
650692 <div class="tm_pb_container clearfix">
651- %5$s
652- <div class="tm_pb_slide_description">
653- <div class="tm_pb_slide_description_inner">
654- %1$s
655- <div class="tm_pb_slide_content%9$s">%2$s</div>
656- %3$s
657- </div>
658- </div> <!-- .tm_pb_slide_description -->
693+ <div class="tm_pb_container_inner">
694+ %5$s
695+ <div class="tm_pb_slide_description%13$s">
696+ <div class="tm_pb_slide_description_inner">
697+ %1$s
698+ <div class="tm_pb_slide_content%9$s">%2$s</div>
699+ %3$s
700+ </div>
701+ </div> <!-- .tm_pb_slide_description -->
702+ </div>
659703 </div> <!-- .tm_pb_container -->
660704 %7$s
661- </div> <!-- .tm_pb_slide -->
662- ' ,
705+ </div> <!-- .tm_pb_slide --> ' ,
663706 $ this ->_var ( 'heading ' ),
664707 $ this ->shortcode_content ,
665708 $ this ->_var ( 'button ' ) . $ this ->_var ( 'button_2 ' ),
@@ -672,7 +715,8 @@ function shortcode_callback( $atts, $content = null, $function_name ) {
672715 ( 'on ' === $ tm_pb_slider_hide_mobile ['hide_content_on_mobile ' ] ? esc_attr ( " {$ hide_on_mobile_class }" ) : '' ),
673716 $ data_dot_nav_custom_color ,
674717 $ data_arrows_custom_color ,
675- 'on ' === $ this ->_var ( 'use_bg_overlay ' ) ? '<div class="tm_pb_slide_overlay_container"></div> ' : ''
718+ 'on ' === $ this ->_var ( 'use_bg_overlay ' ) ? '<div class="tm_pb_slide_overlay_container"></div> ' : '' ,
719+ 'on ' === $ this ->_var ( 'use_heading_bg_image ' ) ? ' tm_pb_heading_image ' : ''
676720 );
677721
678722 return $ output ;
0 commit comments