Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: BarCountersItem.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = esc_html__( 'Bar Counter', 'et_builder' );
[4] Fix | Delete
$this->plural = esc_html__( 'Bar Counters', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_counter';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
$this->type = 'child';
[8] Fix | Delete
$this->child_title_var = 'content';
[9] Fix | Delete
$this->advanced_setting_title_text = esc_html__( 'New Bar Counter', 'et_builder' );
[10] Fix | Delete
$this->settings_text = esc_html__( 'Bar Counter Settings', 'et_builder' );
[11] Fix | Delete
$this->main_css_element = '%%order_class%%';
[12] Fix | Delete
[13] Fix | Delete
$this->advanced_fields = array(
[14] Fix | Delete
'borders' => array(
[15] Fix | Delete
'default' => array(
[16] Fix | Delete
'css' => array(
[17] Fix | Delete
'main' => array(
[18] Fix | Delete
'border_radii' => "{$this->main_css_element} span.et_pb_counter_container, {$this->main_css_element} span.et_pb_counter_amount",
[19] Fix | Delete
'border_styles' => "{$this->main_css_element} span.et_pb_counter_container",
[20] Fix | Delete
),
[21] Fix | Delete
),
[22] Fix | Delete
),
[23] Fix | Delete
),
[24] Fix | Delete
'box_shadow' => array(
[25] Fix | Delete
'default' => array(
[26] Fix | Delete
'css' => array(
[27] Fix | Delete
'main' => '%%order_class%% span.et_pb_counter_container',
[28] Fix | Delete
'overlay' => 'inset',
[29] Fix | Delete
),
[30] Fix | Delete
),
[31] Fix | Delete
),
[32] Fix | Delete
'fonts' => array(
[33] Fix | Delete
'title' => array(
[34] Fix | Delete
'label' => et_builder_i18n( 'Title' ),
[35] Fix | Delete
'css' => array(
[36] Fix | Delete
'main' => ".et_pb_counters {$this->main_css_element} .et_pb_counter_title",
[37] Fix | Delete
),
[38] Fix | Delete
),
[39] Fix | Delete
'percent' => array(
[40] Fix | Delete
'label' => esc_html__( 'Percentage', 'et_builder' ),
[41] Fix | Delete
'css' => array(
[42] Fix | Delete
'main' => ".et_pb_counters {$this->main_css_element} .et_pb_counter_amount_number",
[43] Fix | Delete
'text_align' => ".et_pb_counters {$this->main_css_element} .et_pb_counter_amount",
[44] Fix | Delete
),
[45] Fix | Delete
),
[46] Fix | Delete
),
[47] Fix | Delete
'background' => array(
[48] Fix | Delete
'use_background_color' => 'fields_only',
[49] Fix | Delete
'css' => array(
[50] Fix | Delete
'main' => ".et_pb_counters li{$this->main_css_element} .et_pb_counter_container",
[51] Fix | Delete
),
[52] Fix | Delete
),
[53] Fix | Delete
'margin_padding' => array(
[54] Fix | Delete
'draggable_margin' => false,
[55] Fix | Delete
'draggable_padding' => false,
[56] Fix | Delete
'css' => array(
[57] Fix | Delete
'margin' => ".et_pb_counters {$this->main_css_element}",
[58] Fix | Delete
'padding' => ".et_pb_counters {$this->main_css_element} .et_pb_counter_amount",
[59] Fix | Delete
),
[60] Fix | Delete
),
[61] Fix | Delete
'max_width' => array(
[62] Fix | Delete
'css' => array(
[63] Fix | Delete
'module_alignment' => ".et_pb_counters {$this->main_css_element}",
[64] Fix | Delete
),
[65] Fix | Delete
),
[66] Fix | Delete
'text' => array(
[67] Fix | Delete
'css' => array(
[68] Fix | Delete
'text_orientation' => '%%order_class%% .et_pb_counter_title, %%order_class%% .et_pb_counter_amount',
[69] Fix | Delete
),
[70] Fix | Delete
),
[71] Fix | Delete
'button' => false,
[72] Fix | Delete
'sticky' => false,
[73] Fix | Delete
'height' => array(
[74] Fix | Delete
'css' => array(
[75] Fix | Delete
'main' => '%%order_class%% .et_pb_counter_container, %%order_class%% .et_pb_counter_container .et_pb_counter_amount',
[76] Fix | Delete
),
[77] Fix | Delete
),
[78] Fix | Delete
);
[79] Fix | Delete
[80] Fix | Delete
$this->settings_modal_toggles = array(
[81] Fix | Delete
'general' => array(
[82] Fix | Delete
'toggles' => array(
[83] Fix | Delete
'main_content' => et_builder_i18n( 'Text' ),
[84] Fix | Delete
),
[85] Fix | Delete
),
[86] Fix | Delete
'advanced' => array(
[87] Fix | Delete
'toggles' => array(
[88] Fix | Delete
'bar' => esc_html__( 'Bar Counter', 'et_builder' ),
[89] Fix | Delete
),
[90] Fix | Delete
),
[91] Fix | Delete
);
[92] Fix | Delete
[93] Fix | Delete
$this->custom_css_fields = array(
[94] Fix | Delete
'counter_title' => array(
[95] Fix | Delete
'label' => esc_html__( 'Counter Title', 'et_builder' ),
[96] Fix | Delete
'selector' => '.et_pb_counter_title',
[97] Fix | Delete
),
[98] Fix | Delete
'counter_container' => array(
[99] Fix | Delete
'label' => esc_html__( 'Counter Container', 'et_builder' ),
[100] Fix | Delete
'selector' => '.et_pb_counter_container',
[101] Fix | Delete
),
[102] Fix | Delete
'counter_amount' => array(
[103] Fix | Delete
'label' => esc_html__( 'Counter Amount', 'et_builder' ),
[104] Fix | Delete
'selector' => '.et_pb_counter_amount',
[105] Fix | Delete
),
[106] Fix | Delete
);
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
function get_fields() {
[110] Fix | Delete
$fields = array(
[111] Fix | Delete
'content' => array(
[112] Fix | Delete
'label' => et_builder_i18n( 'Title' ),
[113] Fix | Delete
'type' => 'text',
[114] Fix | Delete
'option_category' => 'basic_option',
[115] Fix | Delete
'description' => esc_html__( 'Input a title for your bar.', 'et_builder' ),
[116] Fix | Delete
'toggle_slug' => 'main_content',
[117] Fix | Delete
'dynamic_content' => 'text',
[118] Fix | Delete
'mobile_options' => true,
[119] Fix | Delete
'hover' => 'tabs',
[120] Fix | Delete
),
[121] Fix | Delete
'percent' => array(
[122] Fix | Delete
'label' => esc_html__( 'Percent', 'et_builder' ),
[123] Fix | Delete
'type' => 'text',
[124] Fix | Delete
'option_category' => 'basic_option',
[125] Fix | Delete
'description' => esc_html__( 'Define a percentage for this bar.', 'et_builder' ),
[126] Fix | Delete
'toggle_slug' => 'main_content',
[127] Fix | Delete
'default_on_front' => '0',
[128] Fix | Delete
'mobile_options' => true,
[129] Fix | Delete
'hover' => 'tabs',
[130] Fix | Delete
),
[131] Fix | Delete
'bar_background_color' => array(
[132] Fix | Delete
'label' => esc_html__( 'Bar Background Color', 'et_builder' ),
[133] Fix | Delete
'description' => esc_html__( 'This will change the fill color for the bar.', 'et_builder' ),
[134] Fix | Delete
'type' => 'color-alpha',
[135] Fix | Delete
'custom_color' => true,
[136] Fix | Delete
'hover' => 'tabs',
[137] Fix | Delete
'tab_slug' => 'advanced',
[138] Fix | Delete
'toggle_slug' => 'bar',
[139] Fix | Delete
'mobile_options' => true,
[140] Fix | Delete
'sticky' => true,
[141] Fix | Delete
),
[142] Fix | Delete
);
[143] Fix | Delete
[144] Fix | Delete
return $fields;
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
public function get_transition_fields_css_props() {
[148] Fix | Delete
$fields = parent::get_transition_fields_css_props();
[149] Fix | Delete
[150] Fix | Delete
$fields['background_layout'] = array( 'color' => '%%order_class%% .et_pb_counter_title' );
[151] Fix | Delete
$fields['bar_background_color'] = array( 'background-color' => '%%order_class%% .et_pb_counter_amount' );
[152] Fix | Delete
[153] Fix | Delete
return $fields;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
function get_parallax_image_background( $base_name = 'background' ) {
[157] Fix | Delete
global $et_pb_counters_settings;
[158] Fix | Delete
[159] Fix | Delete
// Parallax setting is only derived from parent if bar counter item has no background
[160] Fix | Delete
$use_counter_value = '' !== $this->props['background_color'] || 'on' === $this->props['use_background_color_gradient'] || '' !== $this->props['background_image'] || '' !== $this->props['background_video_mp4'] || '' !== $this->props['background_video_webm'];
[161] Fix | Delete
$background_image = $use_counter_value ? $this->props['background_image'] : $et_pb_counters_settings['background_image'];
[162] Fix | Delete
$parallax = $use_counter_value ? $this->props['parallax'] : $et_pb_counters_settings['parallax'];
[163] Fix | Delete
$parallax_method = $use_counter_value ? $this->props['parallax_method'] : $et_pb_counters_settings['parallax_method'];
[164] Fix | Delete
$parallax_background = '';
[165] Fix | Delete
[166] Fix | Delete
if ( '' !== $background_image && 'on' == $parallax ) {
[167] Fix | Delete
$parallax_classname = array(
[168] Fix | Delete
'et_parallax_bg',
[169] Fix | Delete
);
[170] Fix | Delete
[171] Fix | Delete
if ( 'off' === $parallax_method ) {
[172] Fix | Delete
$parallax_classname[] = 'et_pb_parallax_css';
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
$parallax_background = sprintf(
[176] Fix | Delete
'<div class="et_parallax_bg_wrap"><div
[177] Fix | Delete
class="%1$s"
[178] Fix | Delete
style="background-image: url(%2$s);"
[179] Fix | Delete
></div></div>',
[180] Fix | Delete
esc_attr( implode( ' ', $parallax_classname ) ),
[181] Fix | Delete
esc_attr( $background_image )
[182] Fix | Delete
);
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
return $parallax_background;
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
function video_background( $args = array(), $base_name = 'background' ) {
[189] Fix | Delete
global $et_pb_counters_settings;
[190] Fix | Delete
[191] Fix | Delete
$use_counter_value = '' !== $this->props['background_color'] || 'on' === $this->props['use_background_color_gradient'] || '' !== $this->props['background_image'] || '' !== $this->props['background_video_mp4'] || '' !== $this->props['background_video_webm'];
[192] Fix | Delete
$background_video_mp4 = $use_counter_value && isset( $this->props['background_video_mp4'] ) ? $this->props['background_video_mp4'] : $et_pb_counters_settings['background_video_mp4'];
[193] Fix | Delete
$background_video_webm = $use_counter_value && isset( $this->props['background_video_webm'] ) ? $this->props['background_video_webm'] : $et_pb_counters_settings['background_video_webm'];
[194] Fix | Delete
$background_video_width = $use_counter_value && isset( $this->props['background_video_width'] ) ? $this->props['background_video_width'] : $et_pb_counters_settings['background_video_width'];
[195] Fix | Delete
$background_video_height = $use_counter_value && isset( $this->props['background_video_height'] ) ? $this->props['background_video_height'] : $et_pb_counters_settings['background_video_height'];
[196] Fix | Delete
[197] Fix | Delete
if ( ! empty( $args ) ) {
[198] Fix | Delete
$background_video = self::get_video_background( $args );
[199] Fix | Delete
[200] Fix | Delete
$allow_player_pause = isset( $args['allow_player_pause'] ) ? $args['allow_player_pause'] : 'off';
[201] Fix | Delete
$pause_outside_viewport = isset( $args['background_video_pause_outside_viewport'] ) ? $args['background_video_pause_outside_viewport'] : 'on';
[202] Fix | Delete
} else {
[203] Fix | Delete
$background_video = self::get_video_background(
[204] Fix | Delete
array(
[205] Fix | Delete
'background_video_mp4' => $background_video_mp4,
[206] Fix | Delete
'background_video_webm' => $background_video_webm,
[207] Fix | Delete
'background_video_width' => $background_video_width,
[208] Fix | Delete
'background_video_height' => $background_video_height,
[209] Fix | Delete
)
[210] Fix | Delete
);
[211] Fix | Delete
[212] Fix | Delete
$allow_player_pause = $use_counter_value ? $this->props['allow_player_pause'] : $et_pb_counters_settings['allow_player_pause'];
[213] Fix | Delete
$pause_outside_viewport = $use_counter_value ? $this->props['background_video_pause_outside_viewport'] : $et_pb_counters_settings['background_video_pause_outside_viewport'];
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
$video_background = '';
[217] Fix | Delete
[218] Fix | Delete
if ( $background_video ) {
[219] Fix | Delete
$video_background = sprintf(
[220] Fix | Delete
'<div class="et_pb_section_video_bg%2$s">
[221] Fix | Delete
%1$s
[222] Fix | Delete
</div>',
[223] Fix | Delete
$background_video,
[224] Fix | Delete
( 'on' === $allow_player_pause ? ' et_pb_allow_player_pause' : '' ),
[225] Fix | Delete
( 'off' === $pause_outside_viewport ? ' et_pb_video_play_outside_viewport' : '' )
[226] Fix | Delete
);
[227] Fix | Delete
[228] Fix | Delete
wp_enqueue_style( 'wp-mediaelement' );
[229] Fix | Delete
wp_enqueue_script( 'wp-mediaelement' );
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
// Added classname for module wrapper
[233] Fix | Delete
if ( '' !== $video_background ) {
[234] Fix | Delete
$this->add_classname( array( 'et_pb_section_video', 'et_pb_preload' ) );
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
return $video_background;
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
/**
[241] Fix | Delete
* Set inheritance value for bar counters item.
[242] Fix | Delete
*
[243] Fix | Delete
* This method is introduced to inherit background colors values. There are some situations where not
[244] Fix | Delete
* all inheritance process done here.
[245] Fix | Delete
*
[246] Fix | Delete
* @since 3.27.4
[247] Fix | Delete
*/
[248] Fix | Delete
function maybe_inherit_values() {
[249] Fix | Delete
global $et_pb_counters_settings;
[250] Fix | Delete
[251] Fix | Delete
// To avoid unnecessary inheritance process, ensure to run this action on FE only.
[252] Fix | Delete
if ( ! empty( $et_pb_counters_settings ) && ! is_admin() && ! et_fb_is_enabled() ) {
[253] Fix | Delete
// Get parent and item background hover & responsive status.
[254] Fix | Delete
$is_background_hover = et_pb_hover_options()->is_enabled( 'background', $this->props );
[255] Fix | Delete
$is_background_parent_hover = et_pb_hover_options()->is_enabled( 'background', $et_pb_counters_settings );
[256] Fix | Delete
$is_background_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, 'background' );
[257] Fix | Delete
$is_background_parent_responsive = et_pb_responsive_options()->is_responsive_enabled( $et_pb_counters_settings, 'background' );
[258] Fix | Delete
$is_inherit_parent_hover = ! $is_background_hover && $is_background_parent_hover;
[259] Fix | Delete
$is_inherit_parent_responsive = ! $is_background_responsive && $is_background_parent_responsive;
[260] Fix | Delete
[261] Fix | Delete
// Background hover status.
[262] Fix | Delete
if ( $is_inherit_parent_hover ) {
[263] Fix | Delete
$this->props['background__hover_enabled'] = self::$_->array_get( $et_pb_counters_settings, 'background__hover_enabled', '' );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
// Background responsive status.
[267] Fix | Delete
if ( $is_inherit_parent_responsive ) {
[268] Fix | Delete
$this->props['background_last_edited'] = self::$_->array_get( $et_pb_counters_settings, 'background_last_edited', '' );
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
// Background color and background color enable status.
[272] Fix | Delete
foreach ( array( 'background_color', 'background_enable_color' ) as $field ) {
[273] Fix | Delete
// Desktop. Simple inherit parent value if current item value is empty.
[274] Fix | Delete
$value = self::$_->array_get( $this->props, $field, '' );
[275] Fix | Delete
$parent_value = self::$_->array_get( $et_pb_counters_settings, $field, '' );
[276] Fix | Delete
$this->props[ $field ] = empty( $value ) ? $parent_value : $value;
[277] Fix | Delete
[278] Fix | Delete
// Hover. Inherit parent value only if current item hover is disabled.
[279] Fix | Delete
if ( $is_inherit_parent_hover ) {
[280] Fix | Delete
$this->props[ "{$field}__hover" ] = self::$_->array_get( $et_pb_counters_settings, "{$field}__hover", '' );
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
// Responsive. Inherit parent value only if current item responsive is disabled.
[284] Fix | Delete
if ( $is_inherit_parent_responsive ) {
[285] Fix | Delete
$this->props[ "{$field}_tablet" ] = self::$_->array_get( $et_pb_counters_settings, "{$field}_tablet", '' );
[286] Fix | Delete
$this->props[ "{$field}_phone" ] = self::$_->array_get( $et_pb_counters_settings, "{$field}_phone", '' );
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
}
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* Renders the module output.
[294] Fix | Delete
*
[295] Fix | Delete
* @param array $attrs List of attributes.
[296] Fix | Delete
* @param string $content Content being processed.
[297] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[298] Fix | Delete
*
[299] Fix | Delete
* @return string
[300] Fix | Delete
*/
[301] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[302] Fix | Delete
global $et_pb_counters_settings;
[303] Fix | Delete
[304] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[305] Fix | Delete
$multi_view->set_custom_prop( 'use_percentages', $et_pb_counters_settings['use_percentages'] );
[306] Fix | Delete
[307] Fix | Delete
$percent = $multi_view->get_value( 'percent' );
[308] Fix | Delete
$bar_background_color = self::$_->array_get( $this->props, 'bar_background_color' );
[309] Fix | Delete
$bar_background_color = empty( $bar_background_color ) ? $et_pb_counters_settings['bar_bg_color'] : $bar_background_color;
[310] Fix | Delete
$background_image = $this->props['background_image'];
[311] Fix | Delete
$use_background_color_gradient = $this->props['use_background_color_gradient'];
[312] Fix | Delete
[313] Fix | Delete
// Background Color.
[314] Fix | Delete
$background_color = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_color', 'desktop' );
[315] Fix | Delete
$background_color_tablet = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_color', 'tablet' );
[316] Fix | Delete
$background_color_phone = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_color', 'phone' );
[317] Fix | Delete
[318] Fix | Delete
// Bar background color responsive. First of all, check if value from bar counters item is
[319] Fix | Delete
// exist and responsive setting is enabled. If it doesn't exist, get it from bar counters
[320] Fix | Delete
// and also ensure responsive setting is enabled.
[321] Fix | Delete
$is_bar_background_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, 'bar_background_color' );
[322] Fix | Delete
[323] Fix | Delete
$bar_background_color_tablet = $is_bar_background_color_responsive ? et_pb_responsive_options()->get_any_value( $this->props, 'bar_background_color_tablet' ) : '';
[324] Fix | Delete
$bar_background_color_tablet = '' === $bar_background_color_tablet ? $et_pb_counters_settings['bar_bg_color_tablet'] : $bar_background_color_tablet;
[325] Fix | Delete
[326] Fix | Delete
$bar_background_color_phone = $is_bar_background_color_responsive ? et_pb_responsive_options()->get_any_value( $this->props, 'bar_background_color_phone' ) : '';
[327] Fix | Delete
$bar_background_color_phone = '' === $bar_background_color_phone ? $et_pb_counters_settings['bar_bg_color_phone'] : $bar_background_color_phone;
[328] Fix | Delete
[329] Fix | Delete
// Add % only if it hasn't been added to the attribute
[330] Fix | Delete
if ( '%' !== substr( trim( $percent ), -1 ) ) {
[331] Fix | Delete
$percent .= '%';
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
$background_color_style = $bar_bg_color_style = '';
[335] Fix | Delete
$parent_bg_image = isset( $et_pb_counters_settings['background_image'] ) ? $et_pb_counters_settings['background_image'] : '';
[336] Fix | Delete
$parent_use_bg_gradient = isset( $et_pb_counters_settings['use_background_color_gradient'] ) ? $et_pb_counters_settings['use_background_color_gradient'] : 'off';
[337] Fix | Delete
$parent_enable_bg_image = ! empty( $parent_bg_image ) || 'on' === $parent_use_bg_gradient;
[338] Fix | Delete
[339] Fix | Delete
if ( '' !== $background_color && $parent_enable_bg_image ) {
[340] Fix | Delete
if ( empty( $background_image ) && 'on' !== $use_background_color_gradient ) {
[341] Fix | Delete
ET_Builder_Element::set_style(
[342] Fix | Delete
$render_slug,
[343] Fix | Delete
array(
[344] Fix | Delete
'selector' => '.et_pb_counters %%order_class%% .et_pb_counter_container',
[345] Fix | Delete
'declaration' => 'background-image: none!important;',
[346] Fix | Delete
)
[347] Fix | Delete
);
[348] Fix | Delete
}
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
// Background color.
[352] Fix | Delete
$background_color_values = array(
[353] Fix | Delete
'desktop' => esc_html( $background_color ),
[354] Fix | Delete
'tablet' => esc_html( $background_color_tablet ),
[355] Fix | Delete
'phone' => esc_html( $background_color_phone ),
[356] Fix | Delete
);
[357] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $background_color_values, '%%order_class%% .et_pb_counter_container', 'background-color', $render_slug, '', 'color' );
[358] Fix | Delete
[359] Fix | Delete
// Bar background color.
[360] Fix | Delete
$bar_background_color_values = array(
[361] Fix | Delete
'desktop' => esc_html( $bar_background_color ),
[362] Fix | Delete
'tablet' => esc_html( $bar_background_color_tablet ),
[363] Fix | Delete
'phone' => esc_html( $bar_background_color_phone ),
[364] Fix | Delete
);
[365] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $bar_background_color_values, '%%order_class%% .et_pb_counter_amount', 'background-color', $render_slug, '', 'color' );
[366] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $bar_background_color_values, '%%order_class%% .et_pb_counter_amount.overlay', 'color', $render_slug, '', 'color' );
[367] Fix | Delete
[368] Fix | Delete
// Extended (hover & sticky) style of bar and its background color
[369] Fix | Delete
// Background Color.
[370] Fix | Delete
$this->generate_styles(
[371] Fix | Delete
array(
[372] Fix | Delete
'responsive' => false,
[373] Fix | Delete
'render_slug' => $render_slug,
[374] Fix | Delete
'base_attr_name' => 'background_color',
[375] Fix | Delete
'css_property' => 'background-color',
[376] Fix | Delete
'selector' => '.et_pb_counters %%order_class%% .et_pb_counter_container',
[377] Fix | Delete
'hover_pseudo_selector_location' => 'suffix',
[378] Fix | Delete
'sticky_pseudo_selector_location' => 'prefix',
[379] Fix | Delete
'is_sticky_module' => $et_pb_counters_settings['is_sticky_module'],
[380] Fix | Delete
)
[381] Fix | Delete
);
[382] Fix | Delete
[383] Fix | Delete
// Bar Background Color.
[384] Fix | Delete
$this->generate_styles(
[385] Fix | Delete
array(
[386] Fix | Delete
'responsive' => false,
[387] Fix | Delete
'render_slug' => $render_slug,
[388] Fix | Delete
'base_attr_name' => 'bar_background_color',
[389] Fix | Delete
'css_property' => 'background-color',
[390] Fix | Delete
'selector' => '.et_pb_counters %%order_class%% .et_pb_counter_amount',
[391] Fix | Delete
'hover_pseudo_selector_location' => 'order_class',
[392] Fix | Delete
'sticky_pseudo_selector_location' => 'prefix',
[393] Fix | Delete
'is_sticky_module' => $et_pb_counters_settings['is_sticky_module'],
[394] Fix | Delete
)
[395] Fix | Delete
);
[396] Fix | Delete
[397] Fix | Delete
$this->generate_styles(
[398] Fix | Delete
array(
[399] Fix | Delete
'responsive' => false,
[400] Fix | Delete
'render_slug' => $render_slug,
[401] Fix | Delete
'attrs' => $this->props,
[402] Fix | Delete
'base_attr_name' => 'bar_background_color',
[403] Fix | Delete
'css_property' => 'color',
[404] Fix | Delete
'selector' => '.et_pb_counters %%order_class%% .et_pb_counter_amount.overlay',
[405] Fix | Delete
'hover_pseudo_selector_location' => 'order_class',
[406] Fix | Delete
'sticky_pseudo_selector_location' => 'prefix',
[407] Fix | Delete
'is_sticky_module' => $et_pb_counters_settings['is_sticky_module'],
[408] Fix | Delete
)
[409] Fix | Delete
);
[410] Fix | Delete
[411] Fix | Delete
$video_background = $this->video_background();
[412] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[413] Fix | Delete
[414] Fix | Delete
// Module classname
[415] Fix | Delete
$this->add_classname( $this->get_text_orientation_classname() );
[416] Fix | Delete
[417] Fix | Delete
// Remove automatically added classnames
[418] Fix | Delete
$this->remove_classname(
[419] Fix | Delete
array(
[420] Fix | Delete
'et_pb_module',
[421] Fix | Delete
$render_slug,
[422] Fix | Delete
)
[423] Fix | Delete
);
[424] Fix | Delete
[425] Fix | Delete
$multi_view_data_title = $multi_view->render_attrs(
[426] Fix | Delete
array(
[427] Fix | Delete
'content' => '{{content}}',
[428] Fix | Delete
)
[429] Fix | Delete
);
[430] Fix | Delete
[431] Fix | Delete
$multi_view_data_percent_attrs = $multi_view->render_attrs(
[432] Fix | Delete
array(
[433] Fix | Delete
'attrs' => array(
[434] Fix | Delete
'data-width' => '{{percent}}',
[435] Fix | Delete
),
[436] Fix | Delete
'target' => '%%order_class%% .et_pb_counter_amount',
[437] Fix | Delete
)
[438] Fix | Delete
);
[439] Fix | Delete
[440] Fix | Delete
$multi_view_data_percent_content = $multi_view->render_attrs(
[441] Fix | Delete
array(
[442] Fix | Delete
'content' => '{{percent}}',
[443] Fix | Delete
'visibility' => array(
[444] Fix | Delete
'use_percentages' => 'on',
[445] Fix | Delete
),
[446] Fix | Delete
)
[447] Fix | Delete
);
[448] Fix | Delete
[449] Fix | Delete
$output = sprintf(
[450] Fix | Delete
'<li class="et_pb_counter %6$s">
[451] Fix | Delete
<span class="et_pb_counter_title"%9$s>%1$s</span>
[452] Fix | Delete
<span class="et_pb_counter_container"%4$s%10$s>
[453] Fix | Delete
%8$s
[454] Fix | Delete
%7$s
[455] Fix | Delete
<span class="et_pb_counter_amount" style="%5$s" data-width="%3$s"><span class="et_pb_counter_amount_number"><span class="et_pb_counter_amount_number_inner"%11$s>%2$s</span></span></span>
[456] Fix | Delete
<span class="et_pb_counter_amount overlay" style="%5$s" data-width="%3$s"><span class="et_pb_counter_amount_number"><span class="et_pb_counter_amount_number_inner"%11$s>%2$s</span></span></span>
[457] Fix | Delete
</span>
[458] Fix | Delete
</li>',
[459] Fix | Delete
sanitize_text_field( $content ), // #1
[460] Fix | Delete
$multi_view->has_value( 'use_percentages', 'on' ) ? esc_html( $percent ) : '',
[461] Fix | Delete
esc_attr( $percent ),
[462] Fix | Delete
$background_color_style,
[463] Fix | Delete
$bar_bg_color_style, // #5
[464] Fix | Delete
$this->module_classname( $render_slug ),
[465] Fix | Delete
$video_background,
[466] Fix | Delete
$parallax_image_background,
[467] Fix | Delete
$multi_view_data_title,
[468] Fix | Delete
$multi_view_data_percent_attrs, // #10
[469] Fix | Delete
$multi_view_data_percent_content
[470] Fix | Delete
);
[471] Fix | Delete
[472] Fix | Delete
return $output;
[473] Fix | Delete
}
[474] Fix | Delete
[475] Fix | Delete
/**
[476] Fix | Delete
* Filter multi view value.
[477] Fix | Delete
*
[478] Fix | Delete
* @since 3.27.1
[479] Fix | Delete
*
[480] Fix | Delete
* @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
[481] Fix | Delete
*
[482] Fix | Delete
* @param mixed $raw_value Props raw value.
[483] Fix | Delete
* @param array $args {
[484] Fix | Delete
* Context data.
[485] Fix | Delete
*
[486] Fix | Delete
* @type string $context Context param: content, attrs, visibility, classes.
[487] Fix | Delete
* @type string $name Module options props name.
[488] Fix | Delete
* @type string $mode Current data mode: desktop, hover, tablet, phone.
[489] Fix | Delete
* @type string $attr_key Attribute key for attrs context data. Example: src, class, etc.
[490] Fix | Delete
* @type string $attr_sub_key Attribute sub key that availabe when passing attrs value as array such as styes. Example: padding-top, margin-botton, etc.
[491] Fix | Delete
* }
[492] Fix | Delete
*
[493] Fix | Delete
* @return mixed
[494] Fix | Delete
*/
[495] Fix | Delete
public function multi_view_filter_value( $raw_value, $args ) {
[496] Fix | Delete
$name = isset( $args['name'] ) ? $args['name'] : '';
[497] Fix | Delete
[498] Fix | Delete
if ( $raw_value && 'percent' === $name ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function