| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www/wp-content/themes/Divi/includes/builder/module/helpers/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
// Include dependency for ResponsiveOptions.
if ( ! function_exists( 'et_pb_responsive_options' ) ) {
require_once 'ResponsiveOptions.php';
}
// Include dependency for HoverOptions.
if ( ! function_exists( 'et_pb_hover_options' ) ) {
require_once 'HoverOptions.php';
}
/**
* Background layout helper methods.
*
* @since 4.0.7
*
* Class ET_Builder_Module_Helper_BackgroundLayout
*/
class ET_Builder_Module_Helper_BackgroundLayout {
public static function instance() {
static $instance;
return $instance ? $instance : $instance = new self();
}
/**
* Get background layout class names.
*
* @since 4.0.7
*
* @param array $attrs
* @param boolean $is_skip_desktop Not all modules need to print desktop background layout.
* @param boolean $is_text_color Not all modules need text color layout class name.
*
* @return array
*/
public function get_background_layout_class( $attrs, $is_skip_desktop = false, $is_text_color = false ) {
// Background layout values.
$background_layouts = et_pb_responsive_options()->get_property_values( $attrs, 'background_layout' );
$background_layout = et_()->array_get( $background_layouts, 'desktop', '' );
$background_layout_tablet = et_()->array_get( $background_layouts, 'tablet', '' );
$background_layout_phone = et_()->array_get( $background_layouts, 'phone', '' );
$background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $attrs, 'light' );
// Background layout class names.
$background_layout_class_names = ! $is_skip_desktop ? array( "et_pb_bg_layout_{$background_layout}" ) : array();
if ( ! empty( $background_layout_tablet ) ) {
$background_layout_class_names[] = "et_pb_bg_layout_{$background_layout_tablet}_tablet";
}
if ( ! empty( $background_layout_phone ) ) {
$background_layout_class_names[] = "et_pb_bg_layout_{$background_layout_phone}_phone";
}
// Text color class names.
if ( $is_text_color ) {
if ( 'light' === $background_layout ) {
$background_layout_class_names[] = 'et_pb_text_color_dark';
}
if ( 'light' === $background_layout_tablet ) {
$background_layout_class_names[] = 'et_pb_text_color_dark_tablet';
}
if ( 'light' === $background_layout_phone ) {
$background_layout_class_names[] = 'et_pb_text_color_dark_phone';
}
}
return $background_layout_class_names;
}
/**
* Get background layout data attributes.
*
* @since 4.0.7
*
* @param array $attrs
*
* @return string
*/
public function get_background_layout_attrs( $attrs ) {
// Background layout data attributes is only needed by hover effect.
if ( ! et_pb_hover_options()->is_enabled( 'background_layout', $attrs ) ) {
return '';
}
// Background layout values.
$background_layouts = et_pb_responsive_options()->get_property_values( $attrs, 'background_layout' );
$background_layout = et_()->array_get( $background_layouts, 'desktop', '' );
$background_layout_tablet = et_()->array_get( $background_layouts, 'tablet', '' );
$background_layout_phone = et_()->array_get( $background_layouts, 'phone', '' );
$background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $attrs, 'light' );
$data_background_layout = sprintf(
' data-background-layout="%1$s"',
esc_attr( $background_layout )
);
$data_background_layout .= sprintf(
' data-background-layout-hover="%1$s"',
esc_attr( $background_layout_hover )
);
if ( ! empty( $background_layout_tablet ) ) {
$data_background_layout .= sprintf(
' data-background-layout-tablet="%1$s"',
esc_attr( $background_layout_tablet )
);
}
if ( ! empty( $background_layout_phone ) ) {
$data_background_layout .= sprintf(
' data-background-layout-phone="%1$s"',
esc_attr( $background_layout_phone )
);
}
return $data_background_layout;
}
}