iaBuilder::$full_el_no_section ) ) ) { $params['close'] = false; } } if( $bottom_border == 'border-extra-arrow-down' ) { $params['class'] .= ' av-arrow-down-section'; } $params['container_style_tag'] = $element_styling->get_style_tag( $element_id ); $params['svg_dividers'] = AviaSvgShapes()->get_svg_dividers( $atts, $element_styling ); $avia_config['layout_container'] = 'section'; $output = ''; $output .= avia_new_section( $params ); $output .= ShortcodeHelper::avia_remove_autop( $content, true ) ; /*set extra arrow element*/ if( strpos( $bottom_border, 'border-extra' ) !== false ) { if( strpos( $bottom_border, 'diagonal') !== false ) { // bottom_border_diagonal_direction // bottom_border_diagonal_color $bottom_border .= ' ' . $bottom_border_diagonal_direction . ' ' . $bottom_border_style; } avia_sc_section::$add_to_closing = "
"; } else { avia_sc_section::$add_to_closing = ''; } //next section needs an extra closing tag if overlay with wrapper was added: if( $overlay || ! empty( $scroll_down ) ) { avia_sc_section::$close_overlay = ''; } else { avia_sc_section::$close_overlay = ''; } //if the next tag is a section dont create a new section from this shortcode if( ! empty( $meta['siblings']['next']['tag'] ) && in_array( $meta['siblings']['next']['tag'], AviaBuilder::$full_el ) ) { $skipSecond = true; } //if there is no next element dont create a new section. if we got a sidebar always create a next section at the bottom if( empty( $meta['siblings']['next']['tag'] ) && ! avia_has_sidebar() ) { $skipSecond = true; } if( empty( $skipSecond ) ) { $new_params['id'] = 'after_section_' . avia_sc_section::$section_count; $output .= avia_new_section( $new_params ); } unset( $avia_config['layout_container'] ); return $output; } /** * Get background image for ALB editor canvas only * * @param array $args * @return string */ protected function get_bg_string( array $args ) { $style = ''; if( ! empty( $args['attachment'] ) || ! empty( $args['src'] ) ) { $image = false; if( empty( $args['attachment'] ) ) { // manually added image link $image = $args['src']; } else { $src = wp_get_attachment_image_src( $args['attachment'], $args['attachment_size'] ); if( ! empty( $src[0] ) ) { $image = $src[0]; } } if( $image ) { $element_styling = new aviaElementStyling( $this, 'xxx' ); // $bg = ! empty( $args['custom_bg'] ) ? $args['custom_bg'] : 'transparent'; $bg = 'transparent'; $pos = $element_styling->background_position_string( $args['position'], 'center center' ); $repeat = ! empty( $args['repeat'] ) ? $args['repeat'] : 'no-repeat'; $extra = ''; if( $repeat == 'stretch' ) { $repeat = 'no-repeat'; $extra = 'background-size: cover;'; } if( $repeat == 'contain' ) { $repeat = 'no-repeat'; $extra = 'background-size: contain;'; } $style = "background: {$bg} url({$image}) {$repeat} {$pos}; {$extra}"; } } return $style; } } } if( ! function_exists( 'avia_new_section' ) ) { function avia_new_section( $params = array() ) { global $avia_section_markup, $avia_config; $defaults = array( 'class' => 'main_color', 'bg' => '', 'custom_margin' => '', 'close' => true, 'open' => true, 'open_structure' => true, 'open_color_wrap' => true, 'data' => '', 'style' => '', 'id' => '', 'main_container' => false, 'min_height' => '', 'min_height_px' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'attach' => '', 'before_new' => '', 'custom_markup' => '', 'aria_label' => '', // set to true to force id as label 'container_style_tag' => '', // added with 4.8.4 - styles from post CSS management 'svg_dividers' => '' // added with 4.8.4 ); $defaults = array_merge( $defaults, $params ); extract( $defaults ); $post_class = ''; $output = ''; $bg_slider = ''; $container_style = ''; $id_val = $id; $id = ! empty( $id_val ) ? "id='{$id_val}'" : ''; if( ! empty( $aria_label ) || ! empty( $id_val ) ) { if( true === $aria_label ) { $label = $id_val; } else if ( ! empty( $aria_label ) ) { $label = $aria_label; } else { $label = ''; } $aria_label = ! empty( $label ) ? "aria-label='{$label}'" : ''; } else { $aria_label = ''; } //close old content structure. only necessary when previous element was a section. other fullwidth elements dont need this if( $close ) { $cm = avia_section_close_markup(); $output .= "{$cm}" . avia_sc_section::$add_to_closing . avia_sc_section::$close_overlay . ''; avia_sc_section::$add_to_closing = ''; avia_sc_section::$close_overlay = ''; } //start new if( $open ) { if( function_exists( 'avia_get_the_id' ) ) { $post_class = 'post-entry-' . avia_get_the_id(); } if( $open_color_wrap ) { if( ! empty( $min_height ) ) { $class .= " av-minimum-height av-minimum-height-{$min_height} "; if( is_numeric( $min_height ) ) { $data .= " data-av_minimum_height_pc='{$min_height}'"; } if( $min_height == 'custom' && $min_height_px != '' ) { $min_height_px = (int) $min_height_px; $container_style = "style='height:{$min_height_px}px'"; } } if( ! empty( $video ) ) { $slide = array( 'shortcode' => 'av_slideshow', 'content' => '', 'attr' => array( 'id' => '', 'video' => $video , 'slide_type' => 'video', 'video_mute' => true, 'video_loop' => true, 'video_ratio' => $video_ratio, 'video_controls' => 'disabled', 'video_section_bg' => true, 'video_format' => '', 'video_mobile' => '', 'video_mobile_disabled' => $video_mobile_disabled ) ); $bg_slider = new avia_slideshow( array( 'content' => array( $slide ) ) ); $bg_slider->set_extra_class( 'av-section-video-bg' ); $class .= ' av-section-with-video-bg'; $class .= ! empty( $video_mobile_disabled ) ? ' av-section-mobile-video-disabled' : ''; $data .= " data-section-video-ratio='{$video_ratio}'"; } $output .= $before_new; /** * We cant just overwrite style since it might be passed by a function. eg the menu element passes z-index. need to merge the style strings * * @since 4.5.1 by Kriesi */ $extra_style = trim( "{$bg} {$custom_margin}" ); if( ! empty( $extra_style ) ) { $style = trim( $style ); if( empty( $style ) ) { $style = "style='{$extra_style}' "; } else { $style = str_replace( "style='", "style='{$extra_style} ", $style ); $style = str_replace( 'style="', 'style="' . $extra_style . ' ', $style ); } } if( $class == 'main_color' ) { $class .= ' av_default_container_wrap'; } $output .= $container_style_tag; $output .= "
"; $output .= $svg_dividers; $output .= ! empty( $bg_slider ) ? $bg_slider->html() : ''; $output .= $attach; $output .= apply_filters( 'avf_section_container_add', '', $defaults ); } //this applies only for sections. other fullwidth elements dont need the container for centering if( $open_structure ) { if( ! empty( $main_container ) ) { $markup = 'main ' . avia_markup_helper( array( 'context' => 'content', 'echo' => false, 'custom_markup' => $custom_markup ) ); $avia_section_markup = 'main'; } else { $markup = 'div'; } $output .= "
"; $output .= "<{$markup} class='template-page content " . avia_layout_class( 'content', false ) . " units'>"; $output .= "
"; $output .= "
"; } } return $output; } } if( ! function_exists( 'avia_section_close_markup' ) ) { function avia_section_close_markup() { global $avia_section_markup, $avia_config; if( ! empty( $avia_section_markup ) ) { $avia_section_markup = false; $close_markup = ''; } else { $close_markup = '
'; } return $close_markup; } } if( ! function_exists( 'avia_section_after_element_content' ) ) { function avia_section_after_element_content( $meta, $second_id = '', $skipSecond = false, $extra = '' ) { $output = '
'; //close section $output .= $extra; //if the next tag is a section dont create a new section from this shortcode if( ! empty( $meta['siblings']['next']['tag'] ) && in_array( $meta['siblings']['next']['tag'], AviaBuilder::$full_el ) ) { $skipSecond = true; } //if there is no next element dont create a new section. if( empty( $meta['siblings']['next']['tag'] ) ) { $skipSecond = true; } if( empty( $skipSecond ) ) { $output .= avia_new_section( array( 'close' => false, 'id' => $second_id ) ); } return $output; } }