Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: main-structure-elements.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Fires before the builder's structure element classes are loaded.
[2] Fix | Delete
*
[3] Fix | Delete
* @package Divi
[4] Fix | Delete
* @subpackage Builder
[5] Fix | Delete
* @since 4.4.9
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
do_action( 'et_builder_structure_elements_load' );
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Section Element class
[12] Fix | Delete
*
[13] Fix | Delete
* @since [version]
[14] Fix | Delete
*/
[15] Fix | Delete
class ET_Builder_Section extends ET_Builder_Structure_Element {
[16] Fix | Delete
/**
[17] Fix | Delete
* Sets up the element's properties.
[18] Fix | Delete
*/
[19] Fix | Delete
public function init() {
[20] Fix | Delete
$this->name = esc_html__( 'Section', 'et_builder' );
[21] Fix | Delete
$this->plural = esc_html__( 'Sections', 'et_builder' );
[22] Fix | Delete
$this->slug = 'et_pb_section';
[23] Fix | Delete
$this->vb_support = 'on';
[24] Fix | Delete
[25] Fix | Delete
$this->settings_modal_toggles = array(
[26] Fix | Delete
'general' => array(
[27] Fix | Delete
'toggles' => array(
[28] Fix | Delete
'background' => array(
[29] Fix | Delete
'title' => et_builder_i18n( 'Background' ),
[30] Fix | Delete
'sub_toggles' => array(
[31] Fix | Delete
'main' => '',
[32] Fix | Delete
'column_1' => array( 'name' => esc_html__( 'Column 1', 'et_builder' ) ),
[33] Fix | Delete
'column_2' => array( 'name' => esc_html__( 'Column 2', 'et_builder' ) ),
[34] Fix | Delete
'column_3' => array( 'name' => esc_html__( 'Column 3', 'et_builder' ) ),
[35] Fix | Delete
),
[36] Fix | Delete
'priority' => 80,
[37] Fix | Delete
),
[38] Fix | Delete
),
[39] Fix | Delete
),
[40] Fix | Delete
'advanced' => array(
[41] Fix | Delete
'toggles' => array(
[42] Fix | Delete
'layout' => et_builder_i18n( 'Layout' ),
[43] Fix | Delete
'width' => array(
[44] Fix | Delete
'title' => et_builder_i18n( 'Sizing' ),
[45] Fix | Delete
'priority' => 65,
[46] Fix | Delete
),
[47] Fix | Delete
'margin_padding' => array(
[48] Fix | Delete
'title' => esc_html__( 'Spacing', 'et_builder' ),
[49] Fix | Delete
'sub_toggles' => array(
[50] Fix | Delete
'main' => '',
[51] Fix | Delete
'column_1' => array( 'name' => esc_html__( 'Column 1', 'et_builder' ) ),
[52] Fix | Delete
'column_2' => array( 'name' => esc_html__( 'Column 2', 'et_builder' ) ),
[53] Fix | Delete
'column_3' => array( 'name' => esc_html__( 'Column 3', 'et_builder' ) ),
[54] Fix | Delete
),
[55] Fix | Delete
'priority' => 70,
[56] Fix | Delete
),
[57] Fix | Delete
),
[58] Fix | Delete
),
[59] Fix | Delete
'custom_css' => array(
[60] Fix | Delete
'toggles' => array(
[61] Fix | Delete
'classes' => array(
[62] Fix | Delete
'title' => esc_html__( 'CSS ID & Classes', 'et_builder' ),
[63] Fix | Delete
'sub_toggles' => array(
[64] Fix | Delete
'main' => '',
[65] Fix | Delete
'column_1' => array( 'name' => esc_html__( 'Column 1', 'et_builder' ) ),
[66] Fix | Delete
'column_2' => array( 'name' => esc_html__( 'Column 2', 'et_builder' ) ),
[67] Fix | Delete
'column_3' => array( 'name' => esc_html__( 'Column 3', 'et_builder' ) ),
[68] Fix | Delete
),
[69] Fix | Delete
),
[70] Fix | Delete
'custom_css' => array(
[71] Fix | Delete
'title' => et_builder_i18n( 'Custom CSS' ),
[72] Fix | Delete
'sub_toggles' => array(
[73] Fix | Delete
'main' => '',
[74] Fix | Delete
'column_1' => array( 'name' => esc_html__( 'Column 1', 'et_builder' ) ),
[75] Fix | Delete
'column_2' => array( 'name' => esc_html__( 'Column 2', 'et_builder' ) ),
[76] Fix | Delete
'column_3' => array( 'name' => esc_html__( 'Column 3', 'et_builder' ) ),
[77] Fix | Delete
),
[78] Fix | Delete
),
[79] Fix | Delete
),
[80] Fix | Delete
),
[81] Fix | Delete
);
[82] Fix | Delete
[83] Fix | Delete
$this->advanced_fields = array(
[84] Fix | Delete
'background' => array(
[85] Fix | Delete
'use_background_color' => 'fields_only',
[86] Fix | Delete
'use_background_image' => true,
[87] Fix | Delete
'use_background_color_gradient' => true,
[88] Fix | Delete
'use_background_video' => true,
[89] Fix | Delete
'use_background_color_reset' => 'fields_only',
[90] Fix | Delete
'css' => array(
[91] Fix | Delete
'important' => 'all',
[92] Fix | Delete
'main' => 'div.et_pb_section%%order_class%%',
[93] Fix | Delete
),
[94] Fix | Delete
'options' => array(
[95] Fix | Delete
'background_color' => array(
[96] Fix | Delete
'default' => '',
[97] Fix | Delete
'hover' => 'tabs',
[98] Fix | Delete
),
[99] Fix | Delete
'allow_player_pause' => array(
[100] Fix | Delete
'default_on_front' => 'off',
[101] Fix | Delete
),
[102] Fix | Delete
'background_video_pause_outside_viewport' => array(
[103] Fix | Delete
'default_on_front' => 'on',
[104] Fix | Delete
),
[105] Fix | Delete
'parallax' => array(
[106] Fix | Delete
'default_on_front' => 'off',
[107] Fix | Delete
),
[108] Fix | Delete
'parallax_method' => array(
[109] Fix | Delete
'default_on_front' => 'on',
[110] Fix | Delete
),
[111] Fix | Delete
),
[112] Fix | Delete
),
[113] Fix | Delete
'max_width' => array(
[114] Fix | Delete
'css' => array(
[115] Fix | Delete
'module_alignment' => '%%order_class%%',
[116] Fix | Delete
),
[117] Fix | Delete
'options' => array(
[118] Fix | Delete
'module_alignment' => array(
[119] Fix | Delete
'label' => esc_html__( 'Section Alignment', 'et_builder' ),
[120] Fix | Delete
),
[121] Fix | Delete
),
[122] Fix | Delete
'extra' => array(
[123] Fix | Delete
'inner' => array(
[124] Fix | Delete
'css' => array(
[125] Fix | Delete
'main' => array( '%%order_class%% > .et_pb_row', '%%order_class%%.et_section_specialty > .et_pb_row' ),
[126] Fix | Delete
),
[127] Fix | Delete
'options' => array(
[128] Fix | Delete
'width' => array(
[129] Fix | Delete
'label' => esc_html__( 'Inner Width', 'et_builder' ),
[130] Fix | Delete
'depends_show_if' => 'on',
[131] Fix | Delete
'specialty_only' => 'yes',
[132] Fix | Delete
),
[133] Fix | Delete
'max_width' => array(
[134] Fix | Delete
'label' => esc_html__( 'Inner Max Width', 'et_builder' ),
[135] Fix | Delete
'depends_show_if' => 'on',
[136] Fix | Delete
'specialty_only' => 'yes',
[137] Fix | Delete
),
[138] Fix | Delete
'module_alignment' => array(
[139] Fix | Delete
'label' => esc_html__( 'Row Alignment', 'et_builder' ),
[140] Fix | Delete
'depends_show_if' => 'on',
[141] Fix | Delete
'specialty_only' => 'yes',
[142] Fix | Delete
),
[143] Fix | Delete
),
[144] Fix | Delete
),
[145] Fix | Delete
),
[146] Fix | Delete
),
[147] Fix | Delete
'fonts' => false,
[148] Fix | Delete
'text' => false,
[149] Fix | Delete
'button' => false,
[150] Fix | Delete
'z_index' => array(
[151] Fix | Delete
'default' => 'auto',
[152] Fix | Delete
),
[153] Fix | Delete
'position_fields' => array(
[154] Fix | Delete
'default' => 'relative',
[155] Fix | Delete
),
[156] Fix | Delete
);
[157] Fix | Delete
[158] Fix | Delete
$this->help_videos = array(
[159] Fix | Delete
array(
[160] Fix | Delete
'id' => '3kmJ_mMVB1w',
[161] Fix | Delete
'name' => esc_html__( 'An introduction to Sections', 'et_builder' ),
[162] Fix | Delete
),
[163] Fix | Delete
);
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
/**
[167] Fix | Delete
* Get the settings fields data for this element.
[168] Fix | Delete
*
[169] Fix | Delete
* @return array|array[]
[170] Fix | Delete
*/
[171] Fix | Delete
public function get_fields() {
[172] Fix | Delete
$fields = array(
[173] Fix | Delete
'inner_shadow' => array(
[174] Fix | Delete
'label' => esc_html__( 'Show Inner Shadow', 'et_builder' ),
[175] Fix | Delete
'type' => 'yes_no_button',
[176] Fix | Delete
'option_category' => 'configuration',
[177] Fix | Delete
'options' => array(
[178] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[179] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[180] Fix | Delete
),
[181] Fix | Delete
'default' => 'off',
[182] Fix | Delete
'description' => esc_html__( 'Here you can select whether or not your section has an inner shadow. This can look great when you have colored backgrounds or background images.', 'et_builder' ),
[183] Fix | Delete
'tab_slug' => 'advanced',
[184] Fix | Delete
'toggle_slug' => 'layout',
[185] Fix | Delete
'default_on_front' => 'off',
[186] Fix | Delete
),
[187] Fix | Delete
'make_equal' => array(
[188] Fix | Delete
'label' => esc_html__( 'Equalize Column Heights', 'et_builder' ),
[189] Fix | Delete
'description' => esc_html__( 'Equalizing column heights will force all columns to assume the height of the tallest column in the row. All columns will have the same height, keeping their appearance uniform.', 'et_builder' ),
[190] Fix | Delete
'type' => 'yes_no_button',
[191] Fix | Delete
'option_category' => 'layout',
[192] Fix | Delete
'options' => array(
[193] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[194] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[195] Fix | Delete
),
[196] Fix | Delete
'default' => 'off',
[197] Fix | Delete
'tab_slug' => 'advanced',
[198] Fix | Delete
'toggle_slug' => 'width',
[199] Fix | Delete
'specialty_only' => 'yes',
[200] Fix | Delete
),
[201] Fix | Delete
'use_custom_gutter' => array(
[202] Fix | Delete
'label' => esc_html__( 'Use Custom Gutter Width', 'et_builder' ),
[203] Fix | Delete
'description' => esc_html__( 'Enable this option to define custom gutter width for this section.', 'et_builder' ),
[204] Fix | Delete
'type' => 'yes_no_button',
[205] Fix | Delete
'option_category' => 'layout',
[206] Fix | Delete
'options' => array(
[207] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[208] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[209] Fix | Delete
),
[210] Fix | Delete
'default' => 'off',
[211] Fix | Delete
'affects' => array(
[212] Fix | Delete
'gutter_width',
[213] Fix | Delete
),
[214] Fix | Delete
'tab_slug' => 'advanced',
[215] Fix | Delete
'toggle_slug' => 'width',
[216] Fix | Delete
'specialty_only' => 'yes',
[217] Fix | Delete
),
[218] Fix | Delete
'gutter_width' => array(
[219] Fix | Delete
'label' => esc_html__( 'Gutter Width', 'et_builder' ),
[220] Fix | Delete
'type' => 'range',
[221] Fix | Delete
'option_category' => 'layout',
[222] Fix | Delete
'range_settings' => array(
[223] Fix | Delete
'min' => 1,
[224] Fix | Delete
'max' => 4,
[225] Fix | Delete
'step' => 1,
[226] Fix | Delete
'min_limit' => 1,
[227] Fix | Delete
'max_limit' => 4,
[228] Fix | Delete
),
[229] Fix | Delete
'depends_show_if' => 'on',
[230] Fix | Delete
'tab_slug' => 'advanced',
[231] Fix | Delete
'toggle_slug' => 'width',
[232] Fix | Delete
'specialty_only' => 'yes',
[233] Fix | Delete
'validate_unit' => false,
[234] Fix | Delete
'fixed_range' => true,
[235] Fix | Delete
'default_on_front' => (string) et_get_option( 'gutter_width', '3' ),
[236] Fix | Delete
'hover' => 'tabs',
[237] Fix | Delete
'description' => esc_html__( 'Gutter width controls the space between each column in a row. Lowering the gutter width will cause modules to become closer together.', 'et_builder' ),
[238] Fix | Delete
),
[239] Fix | Delete
'columns_background' => array(
[240] Fix | Delete
'type' => 'column_settings_background',
[241] Fix | Delete
'option_category' => 'configuration',
[242] Fix | Delete
'toggle_slug' => 'background',
[243] Fix | Delete
'specialty_only' => 'yes',
[244] Fix | Delete
'priority' => 99,
[245] Fix | Delete
),
[246] Fix | Delete
'columns_padding' => array(
[247] Fix | Delete
'type' => 'column_settings_padding',
[248] Fix | Delete
'option_category' => 'configuration',
[249] Fix | Delete
'tab_slug' => 'advanced',
[250] Fix | Delete
'toggle_slug' => 'margin_padding',
[251] Fix | Delete
'specialty_only' => 'yes',
[252] Fix | Delete
'priority' => 99,
[253] Fix | Delete
),
[254] Fix | Delete
'fullwidth' => array(
[255] Fix | Delete
'type' => 'hidden',
[256] Fix | Delete
'default_on_front' => 'off',
[257] Fix | Delete
),
[258] Fix | Delete
'specialty' => array(
[259] Fix | Delete
'type' => 'skip',
[260] Fix | Delete
'default_on_front' => 'off',
[261] Fix | Delete
'affects' => array( 'inner_width', 'inner_max_width' ),
[262] Fix | Delete
),
[263] Fix | Delete
'columns_css' => array(
[264] Fix | Delete
'type' => 'column_settings_css',
[265] Fix | Delete
'option_category' => 'configuration',
[266] Fix | Delete
'tab_slug' => 'custom_css',
[267] Fix | Delete
'toggle_slug' => 'custom_css',
[268] Fix | Delete
'priority' => 20,
[269] Fix | Delete
),
[270] Fix | Delete
'columns_css_fields' => array(
[271] Fix | Delete
'type' => 'column_settings_css_fields',
[272] Fix | Delete
'option_category' => 'configuration',
[273] Fix | Delete
'tab_slug' => 'custom_css',
[274] Fix | Delete
'toggle_slug' => 'classes',
[275] Fix | Delete
'priority' => 20,
[276] Fix | Delete
),
[277] Fix | Delete
'custom_padding_last_edited' => array(
[278] Fix | Delete
'type' => 'skip',
[279] Fix | Delete
'tab_slug' => 'advanced',
[280] Fix | Delete
'specialty_only' => 'yes',
[281] Fix | Delete
),
[282] Fix | Delete
'__video_background' => array(
[283] Fix | Delete
'type' => 'computed',
[284] Fix | Delete
'computed_callback' => array( 'ET_Builder_Module_Helper_ResponsiveOptions', 'get_video_background' ),
[285] Fix | Delete
'computed_depends_on' => array(
[286] Fix | Delete
'background_video_mp4',
[287] Fix | Delete
'background_video_webm',
[288] Fix | Delete
'background_video_width',
[289] Fix | Delete
'background_video_height',
[290] Fix | Delete
),
[291] Fix | Delete
'computed_minimum' => array(
[292] Fix | Delete
'background_video_mp4',
[293] Fix | Delete
'background_video_webm',
[294] Fix | Delete
),
[295] Fix | Delete
),
[296] Fix | Delete
'prev_background_color' => array(
[297] Fix | Delete
'type' => 'skip',
[298] Fix | Delete
),
[299] Fix | Delete
'next_background_color' => array(
[300] Fix | Delete
'type' => 'skip',
[301] Fix | Delete
),
[302] Fix | Delete
);
[303] Fix | Delete
[304] Fix | Delete
$column_fields = $this->get_column_fields(
[305] Fix | Delete
3,
[306] Fix | Delete
array(
[307] Fix | Delete
'parallax' => array(
[308] Fix | Delete
'default_on_front' => 'off',
[309] Fix | Delete
),
[310] Fix | Delete
'parallax_method' => array(
[311] Fix | Delete
'default_on_front' => 'on',
[312] Fix | Delete
),
[313] Fix | Delete
'background_color' => array(),
[314] Fix | Delete
'bg_img' => array(),
[315] Fix | Delete
'background_size' => array(),
[316] Fix | Delete
'background_position' => array(),
[317] Fix | Delete
'background_repeat' => array(),
[318] Fix | Delete
'background_blend' => array(),
[319] Fix | Delete
'padding_top_bottom_link' => array(),
[320] Fix | Delete
'padding_left_right_link' => array(),
[321] Fix | Delete
'use_background_color_gradient' => array(),
[322] Fix | Delete
'background_color_gradient_start' => array(),
[323] Fix | Delete
'background_color_gradient_end' => array(),
[324] Fix | Delete
'background_color_gradient_type' => array(),
[325] Fix | Delete
'background_color_gradient_direction' => array(),
[326] Fix | Delete
'background_color_gradient_direction_radial' => array(),
[327] Fix | Delete
'background_color_gradient_start_position' => array(),
[328] Fix | Delete
'background_color_gradient_end_position' => array(),
[329] Fix | Delete
'background_color_gradient_overlays_image' => array(),
[330] Fix | Delete
'background_video_mp4' => array(
[331] Fix | Delete
'computed_affects' => array(
[332] Fix | Delete
'__video_background',
[333] Fix | Delete
),
[334] Fix | Delete
),
[335] Fix | Delete
'background_video_webm' => array(
[336] Fix | Delete
'computed_affects' => array(
[337] Fix | Delete
'__video_background',
[338] Fix | Delete
),
[339] Fix | Delete
),
[340] Fix | Delete
'background_video_width' => array(
[341] Fix | Delete
'computed_affects' => array(
[342] Fix | Delete
'__video_background',
[343] Fix | Delete
),
[344] Fix | Delete
),
[345] Fix | Delete
'background_video_height' => array(
[346] Fix | Delete
'computed_affects' => array(
[347] Fix | Delete
'__video_background',
[348] Fix | Delete
),
[349] Fix | Delete
),
[350] Fix | Delete
'allow_player_pause' => array(
[351] Fix | Delete
'computed_affects' => array(
[352] Fix | Delete
'__video_background',
[353] Fix | Delete
),
[354] Fix | Delete
),
[355] Fix | Delete
'background_video_pause_outside_viewport' => array(
[356] Fix | Delete
'computed_affects' => array(
[357] Fix | Delete
'__video_background',
[358] Fix | Delete
),
[359] Fix | Delete
),
[360] Fix | Delete
'__video_background' => array(
[361] Fix | Delete
'type' => 'computed',
[362] Fix | Delete
'computed_callback' => array(
[363] Fix | Delete
'ET_Builder_Column',
[364] Fix | Delete
'get_column_video_background',
[365] Fix | Delete
),
[366] Fix | Delete
'computed_depends_on' => array(
[367] Fix | Delete
'background_video_mp4',
[368] Fix | Delete
'background_video_webm',
[369] Fix | Delete
'background_video_width',
[370] Fix | Delete
'background_video_height',
[371] Fix | Delete
),
[372] Fix | Delete
'computed_minimum' => array(
[373] Fix | Delete
'background_video_mp4',
[374] Fix | Delete
'background_video_webm',
[375] Fix | Delete
),
[376] Fix | Delete
),
[377] Fix | Delete
'padding_top' => array( 'tab_slug' => 'advanced' ),
[378] Fix | Delete
'padding_right' => array( 'tab_slug' => 'advanced' ),
[379] Fix | Delete
'padding_bottom' => array( 'tab_slug' => 'advanced' ),
[380] Fix | Delete
'padding_left' => array( 'tab_slug' => 'advanced' ),
[381] Fix | Delete
'padding_top_bottom_link' => array( 'tab_slug' => 'advanced' ),
[382] Fix | Delete
'padding_left_right_link' => array( 'tab_slug' => 'advanced' ),
[383] Fix | Delete
'padding_%column_index%_tablet' => array(
[384] Fix | Delete
'has_custom_index_location' => true,
[385] Fix | Delete
'tab_slug' => 'advanced',
[386] Fix | Delete
),
[387] Fix | Delete
'padding_%column_index%_phone' => array(
[388] Fix | Delete
'has_custom_index_location' => true,
[389] Fix | Delete
'tab_slug' => 'advanced',
[390] Fix | Delete
),
[391] Fix | Delete
'padding_%column_index%_last_edited' => array(
[392] Fix | Delete
'has_custom_index_location' => true,
[393] Fix | Delete
'tab_slug' => 'advanced',
[394] Fix | Delete
),
[395] Fix | Delete
'module_id' => array( 'tab_slug' => 'custom_css' ),
[396] Fix | Delete
'module_class' => array( 'tab_slug' => 'custom_css' ),
[397] Fix | Delete
'custom_css_before' => array( 'tab_slug' => 'custom_css' ),
[398] Fix | Delete
'custom_css_main' => array( 'tab_slug' => 'custom_css' ),
[399] Fix | Delete
'custom_css_after' => array( 'tab_slug' => 'custom_css' ),
[400] Fix | Delete
)
[401] Fix | Delete
);
[402] Fix | Delete
[403] Fix | Delete
return array_merge( $fields, $column_fields );
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
/**
[407] Fix | Delete
* Get CSS fields transition of section.
[408] Fix | Delete
*/
[409] Fix | Delete
public function get_transition_fields_css_props() {
[410] Fix | Delete
$fields = parent::get_transition_fields_css_props();
[411] Fix | Delete
[412] Fix | Delete
// Section Dividers Height.
[413] Fix | Delete
foreach ( array( 'top', 'bottom' ) as $placement ) {
[414] Fix | Delete
// Inside sprintf, the double %% prints a literal '%' character.
[415] Fix | Delete
$selector = sprintf(
[416] Fix | Delete
'%%%%order_class%%%%.section_has_divider.et_pb_%1$s_divider .et_pb_%1$s_inside_divider',
[417] Fix | Delete
$placement
[418] Fix | Delete
);
[419] Fix | Delete
$fields[ "{$placement}_divider_height" ] = array(
[420] Fix | Delete
'height' => $selector,
[421] Fix | Delete
'background-size' => $selector,
[422] Fix | Delete
);
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
return $fields;
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
/**
[429] Fix | Delete
* Check if current background is transparent background or not.
[430] Fix | Delete
*
[431] Fix | Delete
* @param string $background_color Background color.
[432] Fix | Delete
*
[433] Fix | Delete
* @return boolean Transparent color status.
[434] Fix | Delete
* @since 3.24.1
[435] Fix | Delete
*/
[436] Fix | Delete
public function is_transparent_background( $background_color = '' ) {
[437] Fix | Delete
$page_setting_section_background = et_builder_settings_get( 'et_pb_section_background_color', get_the_ID() );
[438] Fix | Delete
$is_empty_background_color = '' === $background_color && '' === $page_setting_section_background;
[439] Fix | Delete
$is_layout_block = ET_GB_Block_Layout::is_layout_block() || ET_GB_Block_Layout::is_layout_block_preview();
[440] Fix | Delete
[441] Fix | Delete
return 'rgba(255,255,255,0)' === $background_color
[442] Fix | Delete
|| ( $is_layout_block && $is_empty_background_color )
[443] Fix | Delete
|| ( et_is_builder_plugin_active() && $is_empty_background_color );
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Check if current background should have initial background color.
[448] Fix | Delete
*
[449] Fix | Delete
* @since 3.24.1
[450] Fix | Delete
*
[451] Fix | Delete
* @param string $mode Preview mode.
[452] Fix | Delete
*
[453] Fix | Delete
* @return boolean
[454] Fix | Delete
*/
[455] Fix | Delete
public function is_initial_background_color( $mode = 'desktop' ) {
[456] Fix | Delete
// Ensure $mode parameter not empty.
[457] Fix | Delete
$mode = '' === $mode ? 'desktop' : $mode;
[458] Fix | Delete
$device_suffix = 'desktop' !== $mode && 'hover' !== $mode ? "_{$mode}" : '';
[459] Fix | Delete
[460] Fix | Delete
$parallax = 'hover' === $mode ? et_pb_hover_options()->get_raw_value( 'parallax', $this->props ) : et_pb_responsive_options()->get_any_value( $this->props, "parallax{$device_suffix}", '', true );
[461] Fix | Delete
$background_blend = 'hover' === $mode ? et_pb_hover_options()->get_raw_value( 'background_blend', $this->props ) : et_pb_responsive_options()->get_any_value( $this->props, "background_blend{$device_suffix}", '', true );
[462] Fix | Delete
$use_gradient_value = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'use_background_color_gradient', $mode );
[463] Fix | Delete
$background_image = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_image', $mode );
[464] Fix | Delete
$bg_blend_default = self::$_->array_get( $this->fields_unprocessed, 'background_blend.default', '' );
[465] Fix | Delete
[466] Fix | Delete
$is_gradient_active = 'on' === $use_gradient_value;
[467] Fix | Delete
$is_image_active = '' !== $background_image && 'on' !== $parallax;
[468] Fix | Delete
$is_image_blend = '' !== $background_blend && $background_blend !== $bg_blend_default;
[469] Fix | Delete
[470] Fix | Delete
return $is_gradient_active && $is_image_active && $is_image_blend;
[471] Fix | Delete
}
[472] Fix | Delete
[473] Fix | Delete
/**
[474] Fix | Delete
* Get parallax image background.
[475] Fix | Delete
*
[476] Fix | Delete
* @since 3.24.1
[477] Fix | Delete
* @param string $base_name Background base.
[478] Fix | Delete
*
[479] Fix | Delete
* @return HTML Parallax backgrounds markup.
[480] Fix | Delete
*/
[481] Fix | Delete
public function get_parallax_image_background( $base_name = 'background' ) {
[482] Fix | Delete
$attr_prefix = "{$base_name}_";
[483] Fix | Delete
[484] Fix | Delete
$parallax_processed = array();
[485] Fix | Delete
$parallax_background = '';
[486] Fix | Delete
$hover_suffix = et_pb_hover_options()->get_suffix();
[487] Fix | Delete
$preview_modes = array( $hover_suffix, '_phone', '_tablet', '' );
[488] Fix | Delete
[489] Fix | Delete
// Featured Image as Background.
[490] Fix | Delete
$featured_image = '';
[491] Fix | Delete
$featured_placement = '';
[492] Fix | Delete
$featured_image_src = '';
[493] Fix | Delete
if ( $this->featured_image_background ) {
[494] Fix | Delete
$featured_image = self::$_->array_get( $this->props, 'featured_image', '' );
[495] Fix | Delete
$featured_placement = self::$_->array_get( $this->props, 'featured_placement', '' );
[496] Fix | Delete
$featured_image_src_obj = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
[497] Fix | Delete
$featured_image_src = isset( $featured_image_src_obj[0] ) ? $featured_image_src_obj[0] : '';
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function