Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: Image.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Image extends ET_Builder_Module {
[2] Fix | Delete
function init() {
[3] Fix | Delete
$this->name = et_builder_i18n( 'Image' );
[4] Fix | Delete
$this->plural = esc_html__( 'Images', 'et_builder' );
[5] Fix | Delete
$this->slug = 'et_pb_image';
[6] Fix | Delete
$this->vb_support = 'on';
[7] Fix | Delete
[8] Fix | Delete
$this->settings_modal_toggles = array(
[9] Fix | Delete
'general' => array(
[10] Fix | Delete
'toggles' => array(
[11] Fix | Delete
'main_content' => et_builder_i18n( 'Image' ),
[12] Fix | Delete
'link' => et_builder_i18n( 'Link' ),
[13] Fix | Delete
),
[14] Fix | Delete
),
[15] Fix | Delete
'advanced' => array(
[16] Fix | Delete
'toggles' => array(
[17] Fix | Delete
'overlay' => et_builder_i18n( 'Overlay' ),
[18] Fix | Delete
'alignment' => esc_html__( 'Alignment', 'et_builder' ),
[19] Fix | Delete
'width' => array(
[20] Fix | Delete
'title' => et_builder_i18n( 'Sizing' ),
[21] Fix | Delete
'priority' => 65,
[22] Fix | Delete
),
[23] Fix | Delete
),
[24] Fix | Delete
),
[25] Fix | Delete
'custom_css' => array(
[26] Fix | Delete
'toggles' => array(
[27] Fix | Delete
'animation' => array(
[28] Fix | Delete
'title' => esc_html__( 'Animation', 'et_builder' ),
[29] Fix | Delete
'priority' => 90,
[30] Fix | Delete
),
[31] Fix | Delete
'attributes' => array(
[32] Fix | Delete
'title' => esc_html__( 'Attributes', 'et_builder' ),
[33] Fix | Delete
'priority' => 95,
[34] Fix | Delete
),
[35] Fix | Delete
),
[36] Fix | Delete
),
[37] Fix | Delete
);
[38] Fix | Delete
[39] Fix | Delete
$this->advanced_fields = array(
[40] Fix | Delete
'margin_padding' => array(
[41] Fix | Delete
'css' => array(
[42] Fix | Delete
'important' => array( 'custom_margin' ),
[43] Fix | Delete
),
[44] Fix | Delete
),
[45] Fix | Delete
'borders' => array(
[46] Fix | Delete
'default' => array(
[47] Fix | Delete
'css' => array(
[48] Fix | Delete
'main' => array(
[49] Fix | Delete
'border_radii' => '%%order_class%% .et_pb_image_wrap',
[50] Fix | Delete
'border_styles' => '%%order_class%% .et_pb_image_wrap',
[51] Fix | Delete
),
[52] Fix | Delete
),
[53] Fix | Delete
),
[54] Fix | Delete
),
[55] Fix | Delete
'box_shadow' => array(
[56] Fix | Delete
'default' => array(
[57] Fix | Delete
'css' => array(
[58] Fix | Delete
'main' => '%%order_class%% .et_pb_image_wrap',
[59] Fix | Delete
'overlay' => 'inset',
[60] Fix | Delete
),
[61] Fix | Delete
),
[62] Fix | Delete
),
[63] Fix | Delete
'max_width' => array(
[64] Fix | Delete
'options' => array(
[65] Fix | Delete
'width' => array(
[66] Fix | Delete
'depends_show_if' => 'off',
[67] Fix | Delete
),
[68] Fix | Delete
'max_width' => array(
[69] Fix | Delete
'depends_show_if' => 'off',
[70] Fix | Delete
),
[71] Fix | Delete
),
[72] Fix | Delete
),
[73] Fix | Delete
'height' => array(
[74] Fix | Delete
'css' => array(
[75] Fix | Delete
'main' => '%%order_class%% .et_pb_image_wrap img',
[76] Fix | Delete
),
[77] Fix | Delete
),
[78] Fix | Delete
'fonts' => false,
[79] Fix | Delete
'text' => false,
[80] Fix | Delete
'button' => false,
[81] Fix | Delete
'link_options' => false,
[82] Fix | Delete
);
[83] Fix | Delete
[84] Fix | Delete
$this->help_videos = array(
[85] Fix | Delete
array(
[86] Fix | Delete
'id' => 'cYwqxoHnjNA',
[87] Fix | Delete
'name' => esc_html__( 'An introduction to the Image module', 'et_builder' ),
[88] Fix | Delete
),
[89] Fix | Delete
);
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
function get_fields() {
[93] Fix | Delete
$fields = array(
[94] Fix | Delete
'src' => array(
[95] Fix | Delete
'label' => et_builder_i18n( 'Image' ),
[96] Fix | Delete
'type' => 'upload',
[97] Fix | Delete
'option_category' => 'basic_option',
[98] Fix | Delete
'upload_button_text' => et_builder_i18n( 'Upload an image' ),
[99] Fix | Delete
'choose_text' => esc_attr__( 'Choose an Image', 'et_builder' ),
[100] Fix | Delete
'update_text' => esc_attr__( 'Set As Image', 'et_builder' ),
[101] Fix | Delete
'hide_metadata' => true,
[102] Fix | Delete
'affects' => array(
[103] Fix | Delete
'alt',
[104] Fix | Delete
'title_text',
[105] Fix | Delete
),
[106] Fix | Delete
'description' => esc_html__( 'Upload your desired image, or type in the URL to the image you would like to display.', 'et_builder' ),
[107] Fix | Delete
'toggle_slug' => 'main_content',
[108] Fix | Delete
'dynamic_content' => 'image',
[109] Fix | Delete
'mobile_options' => true,
[110] Fix | Delete
'hover' => 'tabs',
[111] Fix | Delete
),
[112] Fix | Delete
'alt' => array(
[113] Fix | Delete
'label' => esc_html__( 'Image Alternative Text', 'et_builder' ),
[114] Fix | Delete
'type' => 'text',
[115] Fix | Delete
'option_category' => 'basic_option',
[116] Fix | Delete
'depends_show_if' => 'on',
[117] Fix | Delete
'depends_on' => array(
[118] Fix | Delete
'src',
[119] Fix | Delete
),
[120] Fix | Delete
'description' => esc_html__( 'This defines the HTML ALT text. A short description of your image can be placed here.', 'et_builder' ),
[121] Fix | Delete
'tab_slug' => 'custom_css',
[122] Fix | Delete
'toggle_slug' => 'attributes',
[123] Fix | Delete
'dynamic_content' => 'text',
[124] Fix | Delete
),
[125] Fix | Delete
'title_text' => array(
[126] Fix | Delete
'label' => esc_html__( 'Image Title Text', 'et_builder' ),
[127] Fix | Delete
'type' => 'text',
[128] Fix | Delete
'option_category' => 'basic_option',
[129] Fix | Delete
'depends_show_if' => 'on',
[130] Fix | Delete
'depends_on' => array(
[131] Fix | Delete
'src',
[132] Fix | Delete
),
[133] Fix | Delete
'description' => esc_html__( 'This defines the HTML Title text.', 'et_builder' ),
[134] Fix | Delete
'tab_slug' => 'custom_css',
[135] Fix | Delete
'toggle_slug' => 'attributes',
[136] Fix | Delete
'dynamic_content' => 'text',
[137] Fix | Delete
),
[138] Fix | Delete
'show_in_lightbox' => array(
[139] Fix | Delete
'label' => esc_html__( 'Open in Lightbox', 'et_builder' ),
[140] Fix | Delete
'type' => 'yes_no_button',
[141] Fix | Delete
'option_category' => 'configuration',
[142] Fix | Delete
'options' => array(
[143] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[144] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[145] Fix | Delete
),
[146] Fix | Delete
'default_on_front' => 'off',
[147] Fix | Delete
'affects' => array(
[148] Fix | Delete
'url',
[149] Fix | Delete
'url_new_window',
[150] Fix | Delete
),
[151] Fix | Delete
'toggle_slug' => 'link',
[152] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not the image should open in Lightbox. Note: if you select to open the image in Lightbox, url options below will be ignored.', 'et_builder' ),
[153] Fix | Delete
),
[154] Fix | Delete
'url' => array(
[155] Fix | Delete
'label' => esc_html__( 'Image Link URL', 'et_builder' ),
[156] Fix | Delete
'type' => 'text',
[157] Fix | Delete
'option_category' => 'basic_option',
[158] Fix | Delete
'depends_show_if' => 'off',
[159] Fix | Delete
'description' => esc_html__( 'If you would like your image to be a link, input your destination URL here. No link will be created if this field is left blank.', 'et_builder' ),
[160] Fix | Delete
'toggle_slug' => 'link',
[161] Fix | Delete
'dynamic_content' => 'url',
[162] Fix | Delete
),
[163] Fix | Delete
'url_new_window' => array(
[164] Fix | Delete
'label' => esc_html__( 'Image Link Target', 'et_builder' ),
[165] Fix | Delete
'type' => 'select',
[166] Fix | Delete
'option_category' => 'configuration',
[167] Fix | Delete
'options' => array(
[168] Fix | Delete
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
[169] Fix | Delete
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
[170] Fix | Delete
),
[171] Fix | Delete
'default_on_front' => 'off',
[172] Fix | Delete
'depends_show_if' => 'off',
[173] Fix | Delete
'toggle_slug' => 'link',
[174] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
[175] Fix | Delete
),
[176] Fix | Delete
'use_overlay' => array(
[177] Fix | Delete
'label' => esc_html__( 'Image Overlay', 'et_builder' ),
[178] Fix | Delete
'type' => 'yes_no_button',
[179] Fix | Delete
'option_category' => 'layout',
[180] Fix | Delete
'options' => array(
[181] Fix | Delete
'off' => et_builder_i18n( 'Off' ),
[182] Fix | Delete
'on' => et_builder_i18n( 'On' ),
[183] Fix | Delete
),
[184] Fix | Delete
'default_on_front' => 'off',
[185] Fix | Delete
'affects' => array(
[186] Fix | Delete
'overlay_icon_color',
[187] Fix | Delete
'hover_overlay_color',
[188] Fix | Delete
'hover_icon',
[189] Fix | Delete
),
[190] Fix | Delete
'show_if' => array(
[191] Fix | Delete
'function.showImageUseOverlayField' => 'on',
[192] Fix | Delete
),
[193] Fix | Delete
'tab_slug' => 'advanced',
[194] Fix | Delete
'toggle_slug' => 'overlay',
[195] Fix | Delete
'description' => esc_html__( 'If enabled, an overlay color and icon will be displayed when a visitors hovers over the image', 'et_builder' ),
[196] Fix | Delete
),
[197] Fix | Delete
'overlay_icon_color' => array(
[198] Fix | Delete
'label' => esc_html__( 'Overlay Icon Color', 'et_builder' ),
[199] Fix | Delete
'type' => 'color-alpha',
[200] Fix | Delete
'custom_color' => true,
[201] Fix | Delete
'depends_show_if' => 'on',
[202] Fix | Delete
'tab_slug' => 'advanced',
[203] Fix | Delete
'toggle_slug' => 'overlay',
[204] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the overlay icon', 'et_builder' ),
[205] Fix | Delete
'mobile_options' => true,
[206] Fix | Delete
'sticky' => true,
[207] Fix | Delete
),
[208] Fix | Delete
'hover_overlay_color' => array(
[209] Fix | Delete
'label' => esc_html__( 'Hover Overlay Color', 'et_builder' ),
[210] Fix | Delete
'type' => 'color-alpha',
[211] Fix | Delete
'custom_color' => true,
[212] Fix | Delete
'depends_show_if' => 'on',
[213] Fix | Delete
'tab_slug' => 'advanced',
[214] Fix | Delete
'toggle_slug' => 'overlay',
[215] Fix | Delete
'description' => esc_html__( 'Here you can define a custom color for the overlay', 'et_builder' ),
[216] Fix | Delete
'mobile_options' => true,
[217] Fix | Delete
'sticky' => true,
[218] Fix | Delete
),
[219] Fix | Delete
'hover_icon' => array(
[220] Fix | Delete
'label' => esc_html__( 'Hover Icon Picker', 'et_builder' ),
[221] Fix | Delete
'type' => 'select_icon',
[222] Fix | Delete
'option_category' => 'configuration',
[223] Fix | Delete
'class' => array( 'et-pb-font-icon' ),
[224] Fix | Delete
'depends_show_if' => 'on',
[225] Fix | Delete
'tab_slug' => 'advanced',
[226] Fix | Delete
'toggle_slug' => 'overlay',
[227] Fix | Delete
'description' => esc_html__( 'Here you can define a custom icon for the overlay', 'et_builder' ),
[228] Fix | Delete
'mobile_options' => true,
[229] Fix | Delete
'sticky' => true,
[230] Fix | Delete
),
[231] Fix | Delete
'show_bottom_space' => array(
[232] Fix | Delete
'label' => esc_html__( 'Show Space Below The Image', 'et_builder' ),
[233] Fix | Delete
'type' => 'yes_no_button',
[234] Fix | Delete
'option_category' => 'layout',
[235] Fix | Delete
'options' => array(
[236] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[237] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[238] Fix | Delete
),
[239] Fix | Delete
'default_on_front' => 'on',
[240] Fix | Delete
'tab_slug' => 'advanced',
[241] Fix | Delete
'toggle_slug' => 'margin_padding',
[242] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not the image should have a space below it.', 'et_builder' ),
[243] Fix | Delete
'mobile_options' => true,
[244] Fix | Delete
),
[245] Fix | Delete
'align' => array(
[246] Fix | Delete
'label' => esc_html__( 'Image Alignment', 'et_builder' ),
[247] Fix | Delete
'type' => 'text_align',
[248] Fix | Delete
'option_category' => 'layout',
[249] Fix | Delete
'options' => et_builder_get_text_orientation_options( array( 'justified' ) ),
[250] Fix | Delete
'default_on_front' => 'left',
[251] Fix | Delete
'tab_slug' => 'advanced',
[252] Fix | Delete
'toggle_slug' => 'alignment',
[253] Fix | Delete
'description' => esc_html__( 'Here you can choose the image alignment.', 'et_builder' ),
[254] Fix | Delete
'options_icon' => 'module_align',
[255] Fix | Delete
'mobile_options' => true,
[256] Fix | Delete
),
[257] Fix | Delete
'force_fullwidth' => array(
[258] Fix | Delete
'label' => esc_html__( 'Force Fullwidth', 'et_builder' ),
[259] Fix | Delete
'description' => esc_html__( "When enabled, this will force your image to extend 100% of the width of the column it's in.", 'et_builder' ),
[260] Fix | Delete
'type' => 'yes_no_button',
[261] Fix | Delete
'option_category' => 'layout',
[262] Fix | Delete
'options' => array(
[263] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[264] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[265] Fix | Delete
),
[266] Fix | Delete
'default_on_front' => 'off',
[267] Fix | Delete
'tab_slug' => 'advanced',
[268] Fix | Delete
'toggle_slug' => 'width',
[269] Fix | Delete
'affects' => array(
[270] Fix | Delete
'max_width',
[271] Fix | Delete
'width',
[272] Fix | Delete
),
[273] Fix | Delete
),
[274] Fix | Delete
);
[275] Fix | Delete
[276] Fix | Delete
return $fields;
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
public function get_alignment( $device = 'desktop' ) {
[280] Fix | Delete
$is_desktop = 'desktop' === $device;
[281] Fix | Delete
$suffix = ! $is_desktop ? "_{$device}" : '';
[282] Fix | Delete
$alignment = $is_desktop && isset( $this->props['align'] ) ? $this->props['align'] : '';
[283] Fix | Delete
[284] Fix | Delete
if ( ! $is_desktop && et_pb_responsive_options()->is_responsive_enabled( $this->props, 'align' ) ) {
[285] Fix | Delete
$alignment = et_pb_responsive_options()->get_any_value( $this->props, "align{$suffix}" );
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
return et_pb_get_alignment( $alignment );
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
/**
[292] Fix | Delete
* Renders the module output.
[293] Fix | Delete
*
[294] Fix | Delete
* @param array $attrs List of attributes.
[295] Fix | Delete
* @param string $content Content being processed.
[296] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[297] Fix | Delete
*
[298] Fix | Delete
* @return string
[299] Fix | Delete
*/
[300] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[301] Fix | Delete
$sticky = et_pb_sticky_options();
[302] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[303] Fix | Delete
$src = $this->props['src'];
[304] Fix | Delete
$alt = $this->props['alt'];
[305] Fix | Delete
$title_text = $this->props['title_text'];
[306] Fix | Delete
$url = $this->props['url'];
[307] Fix | Delete
$url_new_window = $this->props['url_new_window'];
[308] Fix | Delete
$show_in_lightbox = $this->props['show_in_lightbox'];
[309] Fix | Delete
$align = $this->get_alignment();
[310] Fix | Delete
$align_tablet = $this->get_alignment( 'tablet' );
[311] Fix | Delete
$align_phone = $this->get_alignment( 'phone' );
[312] Fix | Delete
$force_fullwidth = $this->props['force_fullwidth'];
[313] Fix | Delete
$hover_icon = $this->props['hover_icon'];
[314] Fix | Delete
$hover_icon_tablet = $this->props['hover_icon_tablet'];
[315] Fix | Delete
$hover_icon_phone = $this->props['hover_icon_phone'];
[316] Fix | Delete
$hover_icon_sticky = $sticky->get_value( 'hover_icon', $this->props );
[317] Fix | Delete
$use_overlay = $this->props['use_overlay'];
[318] Fix | Delete
$animation_style = $this->props['animation_style'];
[319] Fix | Delete
$box_shadow_style = self::$_->array_get( $this->props, 'box_shadow_style', '' );
[320] Fix | Delete
[321] Fix | Delete
$video_background = $this->video_background();
[322] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[323] Fix | Delete
[324] Fix | Delete
$show_bottom_space = $this->props['show_bottom_space'];
[325] Fix | Delete
$show_bottom_space_values = et_pb_responsive_options()->get_property_values( $this->props, 'show_bottom_space' );
[326] Fix | Delete
$show_bottom_space_tablet = isset( $show_bottom_space_values['tablet'] ) ? $show_bottom_space_values['tablet'] : '';
[327] Fix | Delete
$show_bottom_space_phone = isset( $show_bottom_space_values['phone'] ) ? $show_bottom_space_values['phone'] : '';
[328] Fix | Delete
[329] Fix | Delete
// Handle svg image behaviour
[330] Fix | Delete
$src_pathinfo = pathinfo( $src );
[331] Fix | Delete
$is_src_svg = isset( $src_pathinfo['extension'] ) ? 'svg' === $src_pathinfo['extension'] : false;
[332] Fix | Delete
[333] Fix | Delete
// overlay can be applied only if image has link or if lightbox enabled
[334] Fix | Delete
$is_overlay_applied = 'on' === $use_overlay && ( 'on' === $show_in_lightbox || ( 'off' === $show_in_lightbox && '' !== $url ) ) ? 'on' : 'off';
[335] Fix | Delete
[336] Fix | Delete
if ( 'on' === $force_fullwidth ) {
[337] Fix | Delete
$el_style = array(
[338] Fix | Delete
'selector' => '%%order_class%%',
[339] Fix | Delete
'declaration' => 'width: 100%; max-width: 100% !important;',
[340] Fix | Delete
);
[341] Fix | Delete
ET_Builder_Element::set_style( $render_slug, $el_style );
[342] Fix | Delete
[343] Fix | Delete
$el_style = array(
[344] Fix | Delete
'selector' => '%%order_class%% .et_pb_image_wrap, %%order_class%% img',
[345] Fix | Delete
'declaration' => 'width: 100%;',
[346] Fix | Delete
);
[347] Fix | Delete
ET_Builder_Element::set_style( $render_slug, $el_style );
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
// Responsive Image Alignment.
[351] Fix | Delete
// Set CSS properties and values for the image alignment.
[352] Fix | Delete
// 1. Text Align is necessary, just set it from current image alignment value.
[353] Fix | Delete
// 2. Margin {Side} is optional. Used to pull the image to right/left side.
[354] Fix | Delete
// 3. Margin Left and Right are optional. Used by Center to reset custom margin of point 2.
[355] Fix | Delete
$align_values = array(
[356] Fix | Delete
'desktop' => array(
[357] Fix | Delete
'text-align' => esc_html( $align ),
[358] Fix | Delete
"margin-{$align}" => ! empty( $align ) && 'center' !== $align ? '0' : '',
[359] Fix | Delete
),
[360] Fix | Delete
);
[361] Fix | Delete
[362] Fix | Delete
if ( ! empty( $align_tablet ) ) {
[363] Fix | Delete
$align_values['tablet'] = array(
[364] Fix | Delete
'text-align' => esc_html( $align_tablet ),
[365] Fix | Delete
'margin-left' => 'left' !== $align_tablet ? 'auto' : '',
[366] Fix | Delete
'margin-right' => 'left' !== $align_tablet ? 'auto' : '',
[367] Fix | Delete
"margin-{$align_tablet}" => ! empty( $align_tablet ) && 'center' !== $align_tablet ? '0' : '',
[368] Fix | Delete
);
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
if ( ! empty( $align_phone ) ) {
[372] Fix | Delete
$align_values['phone'] = array(
[373] Fix | Delete
'text-align' => esc_html( $align_phone ),
[374] Fix | Delete
'margin-left' => 'left' !== $align_phone ? 'auto' : '',
[375] Fix | Delete
'margin-right' => 'left' !== $align_phone ? 'auto' : '',
[376] Fix | Delete
"margin-{$align_phone}" => ! empty( $align_phone ) && 'center' !== $align_phone ? '0' : '',
[377] Fix | Delete
);
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $align_values, '%%order_class%%', '', $render_slug, '', 'alignment' );
[381] Fix | Delete
[382] Fix | Delete
// Load up Dynamic Content (if needed) to capture Featured Image objects.
[383] Fix | Delete
// In this way we can process `alt` and `title` attributes defined in
[384] Fix | Delete
// the WP Media Library when they haven't been specified by the user in
[385] Fix | Delete
// Module Settings.
[386] Fix | Delete
if ( empty( $alt ) || empty( $title_text ) ) {
[387] Fix | Delete
$raw_src = et_()->array_get( $this->attrs_unprocessed, 'src' );
[388] Fix | Delete
$src_value = et_builder_parse_dynamic_content( $raw_src );
[389] Fix | Delete
[390] Fix | Delete
if ( $src_value->is_dynamic() && $src_value->get_content() === 'post_featured_image' ) {
[391] Fix | Delete
// If there is no user-specified ALT attribute text, check the WP
[392] Fix | Delete
// Media Library entry for text that may have been added there.
[393] Fix | Delete
if ( empty( $alt ) ) {
[394] Fix | Delete
$alt = et_builder_resolve_dynamic_content( 'post_featured_image_alt_text', array(), get_the_ID(), 'display' );
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
// If there is no user-specified TITLE attribute text, check the WP
[398] Fix | Delete
// Media Library entry for text that may have been added there.
[399] Fix | Delete
if ( empty( $title_text ) ) {
[400] Fix | Delete
$title_text = et_builder_resolve_dynamic_content( 'post_featured_image_title_text', array(), get_the_ID(), 'display' );
[401] Fix | Delete
}
[402] Fix | Delete
}
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
if ( 'on' === $is_overlay_applied ) {
[406] Fix | Delete
$this->generate_styles(
[407] Fix | Delete
array(
[408] Fix | Delete
'hover' => false,
[409] Fix | Delete
'base_attr_name' => 'overlay_icon_color',
[410] Fix | Delete
'selector' => '%%order_class%% .et_overlay:before',
[411] Fix | Delete
'css_property' => 'color',
[412] Fix | Delete
'render_slug' => $render_slug,
[413] Fix | Delete
'important' => true,
[414] Fix | Delete
'type' => 'color',
[415] Fix | Delete
)
[416] Fix | Delete
);
[417] Fix | Delete
[418] Fix | Delete
$this->generate_styles(
[419] Fix | Delete
array(
[420] Fix | Delete
'hover' => false,
[421] Fix | Delete
'base_attr_name' => 'hover_overlay_color',
[422] Fix | Delete
'selector' => '%%order_class%% .et_overlay',
[423] Fix | Delete
'css_property' => 'background-color',
[424] Fix | Delete
'render_slug' => $render_slug,
[425] Fix | Delete
'type' => 'color',
[426] Fix | Delete
)
[427] Fix | Delete
);
[428] Fix | Delete
[429] Fix | Delete
$overlay_output = ET_Builder_Module_Helper_Overlay::render(
[430] Fix | Delete
array(
[431] Fix | Delete
'icon' => $hover_icon,
[432] Fix | Delete
'icon_tablet' => $hover_icon_tablet,
[433] Fix | Delete
'icon_phone' => $hover_icon_phone,
[434] Fix | Delete
'icon_sticky' => $hover_icon_sticky,
[435] Fix | Delete
)
[436] Fix | Delete
);
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
// Set display block for svg image to avoid disappearing svg image
[440] Fix | Delete
if ( $is_src_svg ) {
[441] Fix | Delete
$el_style = array(
[442] Fix | Delete
'selector' => '%%order_class%% .et_pb_image_wrap',
[443] Fix | Delete
'declaration' => 'display: block;',
[444] Fix | Delete
);
[445] Fix | Delete
ET_Builder_Element::set_style( $render_slug, $el_style );
[446] Fix | Delete
}
[447] Fix | Delete
[448] Fix | Delete
$box_shadow_overlay_wrap_class = 'none' !== $box_shadow_style
[449] Fix | Delete
? 'has-box-shadow-overlay'
[450] Fix | Delete
: '';
[451] Fix | Delete
[452] Fix | Delete
$box_shadow_overlay_element = 'none' !== $box_shadow_style
[453] Fix | Delete
? '<div class="box-shadow-overlay"></div>'
[454] Fix | Delete
: '';
[455] Fix | Delete
[456] Fix | Delete
$image_attrs = array(
[457] Fix | Delete
'src' => '{{src}}',
[458] Fix | Delete
'alt' => esc_attr( $alt ),
[459] Fix | Delete
'title' => esc_attr( $title_text ),
[460] Fix | Delete
'height' => 'auto',
[461] Fix | Delete
'width' => 'auto',
[462] Fix | Delete
);
[463] Fix | Delete
[464] Fix | Delete
$image_attachment_class = et_pb_media_options()->get_image_attachment_class( $this->props, 'src' );
[465] Fix | Delete
[466] Fix | Delete
if ( ! empty( $image_attachment_class ) ) {
[467] Fix | Delete
$image_attrs['class'] = esc_attr( $image_attachment_class );
[468] Fix | Delete
}
[469] Fix | Delete
[470] Fix | Delete
$image_html = $multi_view->render_element(
[471] Fix | Delete
array(
[472] Fix | Delete
'tag' => 'img',
[473] Fix | Delete
'attrs' => $image_attrs,
[474] Fix | Delete
'required' => 'src',
[475] Fix | Delete
)
[476] Fix | Delete
);
[477] Fix | Delete
[478] Fix | Delete
$output = sprintf(
[479] Fix | Delete
'<span class="et_pb_image_wrap %3$s">%4$s%1$s%2$s</span>',
[480] Fix | Delete
$image_html,
[481] Fix | Delete
'on' === $is_overlay_applied ? $overlay_output : '',
[482] Fix | Delete
$box_shadow_overlay_wrap_class,
[483] Fix | Delete
$box_shadow_overlay_element
[484] Fix | Delete
);
[485] Fix | Delete
[486] Fix | Delete
if ( 'on' === $show_in_lightbox ) {
[487] Fix | Delete
$output = sprintf(
[488] Fix | Delete
'<a href="%1$s" class="et_pb_lightbox_image" title="%3$s">%2$s</a>',
[489] Fix | Delete
esc_attr( $src ),
[490] Fix | Delete
$output,
[491] Fix | Delete
esc_attr( $alt )
[492] Fix | Delete
);
[493] Fix | Delete
} elseif ( '' !== $url ) {
[494] Fix | Delete
$output = sprintf(
[495] Fix | Delete
'<a href="%1$s"%3$s>%2$s</a>',
[496] Fix | Delete
esc_url( $url ),
[497] Fix | Delete
$output,
[498] Fix | Delete
( 'on' === $url_new_window ? ' target="_blank"' : '' )
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function