Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module/field
File: Position.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Field_Position extends ET_Builder_Module_Field_Base {
[2] Fix | Delete
[3] Fix | Delete
const TAB_SLUG = 'custom_css';
[4] Fix | Delete
const TOGGLE_SLUG = 'position_fields';
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* @var ET_Builder_Element
[8] Fix | Delete
*/
[9] Fix | Delete
private $module;
[10] Fix | Delete
[11] Fix | Delete
public function get_fields( array $args = array() ) {
[12] Fix | Delete
[13] Fix | Delete
$responsive_options = array();
[14] Fix | Delete
$additional_options = array();
[15] Fix | Delete
$skip = array(
[16] Fix | Delete
'type' => 'skip',
[17] Fix | Delete
'tab_slug' => self::TAB_SLUG,
[18] Fix | Delete
'toggle_slug' => self::TOGGLE_SLUG,
[19] Fix | Delete
);
[20] Fix | Delete
[21] Fix | Delete
static $i18n;
[22] Fix | Delete
[23] Fix | Delete
if ( ! isset( $i18n ) ) {
[24] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[25] Fix | Delete
$i18n = array(
[26] Fix | Delete
'positioning' => array(
[27] Fix | Delete
'description' => esc_html__( 'Here you can choose the element\'s position type. Absolutlely positioned elements will float inside their parent elements. Fixed positioned elements will float within the browser viewport. Relatively positioned elements sit statically in their parent container, but can still be offset without disrupting surrounding elements.', 'et_builder' ),
[28] Fix | Delete
'options' => array(
[29] Fix | Delete
'relative' => esc_html__( 'Relative', 'et_builder' ),
[30] Fix | Delete
'absolute' => esc_html__( 'Absolute', 'et_builder' ),
[31] Fix | Delete
'fixed' => esc_html__( 'Fixed', 'et_builder' ),
[32] Fix | Delete
),
[33] Fix | Delete
),
[34] Fix | Delete
'origin' => array(
[35] Fix | Delete
'label' => esc_html__( 'Location', 'et_builder' ),
[36] Fix | Delete
'description' => esc_html__( 'Here you can adjust the element\'s starting location within its parent container. You can further adjust the element\'s position using the offset controls.', 'et_builder' ),
[37] Fix | Delete
),
[38] Fix | Delete
'offset' => array(
[39] Fix | Delete
'label' => esc_html__( 'Offset Origin ', 'et_builder' ),
[40] Fix | Delete
'description' => esc_html__( 'Here you can choose from which corner this element is offset from. The vertical and horizontal offset adjustments will be affected based on the element\'s offset origin.', 'et_builder' ),
[41] Fix | Delete
),
[42] Fix | Delete
'vertical' => array(
[43] Fix | Delete
'label' => esc_html__( 'Vertical Offset', 'et_builder' ),
[44] Fix | Delete
'description' => esc_html__( 'Here you can adjust the element\'s position upwards or downwards from its starting location, which may differ based on its offset origin.', 'et_builder' ),
[45] Fix | Delete
),
[46] Fix | Delete
'horizontal' => array(
[47] Fix | Delete
'label' => esc_html__( 'Horizontal Offset', 'et_builder' ),
[48] Fix | Delete
'description' => esc_html__( 'Here you can adjust the element\'s position left or right from its starting location, which may differ based on its offset origin.', 'et_builder' ),
[49] Fix | Delete
),
[50] Fix | Delete
'zindex' => array(
[51] Fix | Delete
'label' => esc_html__( 'Z Index', 'et_builder' ),
[52] Fix | Delete
'description' => esc_html__( 'Here you can control element position on the z axis. Elements with higher z-index values will sit atop elements with lower z-index values.', 'et_builder' ),
[53] Fix | Delete
),
[54] Fix | Delete
);
[55] Fix | Delete
// phpcs:enable
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
if ( ! $args['hide_position_fields'] ) {
[59] Fix | Delete
[60] Fix | Delete
$corner_options = array(
[61] Fix | Delete
'top_left' => et_builder_i18n( 'Top Left' ),
[62] Fix | Delete
'top_right' => et_builder_i18n( 'Top Right' ),
[63] Fix | Delete
'bottom_left' => et_builder_i18n( 'Bottom Left' ),
[64] Fix | Delete
'bottom_right' => et_builder_i18n( 'Bottom Right' ),
[65] Fix | Delete
);
[66] Fix | Delete
[67] Fix | Delete
$center_options = array(
[68] Fix | Delete
'center_left' => et_builder_i18n( 'Center Left' ),
[69] Fix | Delete
'center_center' => et_builder_i18n( 'Center Center' ),
[70] Fix | Delete
'center_right' => et_builder_i18n( 'Center Right' ),
[71] Fix | Delete
'top_center' => et_builder_i18n( 'Top Center' ),
[72] Fix | Delete
'bottom_center' => et_builder_i18n( 'Bottom Center' ),
[73] Fix | Delete
);
[74] Fix | Delete
[75] Fix | Delete
$additional_options['positioning'] = array(
[76] Fix | Delete
'label' => et_builder_i18n( 'Position' ),
[77] Fix | Delete
'description' => $i18n['positioning']['description'],
[78] Fix | Delete
'type' => 'select',
[79] Fix | Delete
'options' => array(
[80] Fix | Delete
'none' => et_builder_i18n( 'Default' ),
[81] Fix | Delete
'relative' => $i18n['positioning']['options']['relative'],
[82] Fix | Delete
'absolute' => $i18n['positioning']['options']['absolute'],
[83] Fix | Delete
'fixed' => $i18n['positioning']['options']['fixed'],
[84] Fix | Delete
),
[85] Fix | Delete
'option_category' => 'layout',
[86] Fix | Delete
'default' => $args['defaults']['positioning'],
[87] Fix | Delete
'default_on_child' => true,
[88] Fix | Delete
'tab_slug' => self::TAB_SLUG,
[89] Fix | Delete
'toggle_slug' => self::TOGGLE_SLUG,
[90] Fix | Delete
'mobile_options' => true,
[91] Fix | Delete
'hover' => 'tabs',
[92] Fix | Delete
'bb_support' => false,
[93] Fix | Delete
'linked_responsive' => array( 'position_origin_a', 'position_origin_f', 'position_origin_r' ),
[94] Fix | Delete
);
[95] Fix | Delete
[96] Fix | Delete
// Position origin/location options
[97] Fix | Delete
$origin_option = array(
[98] Fix | Delete
'label' => $i18n['origin']['label'],
[99] Fix | Delete
'description' => $i18n['origin']['description'],
[100] Fix | Delete
'type' => 'position',
[101] Fix | Delete
'options' => $corner_options + $center_options,
[102] Fix | Delete
'option_category' => 'layout',
[103] Fix | Delete
'default' => $args['defaults']['position_origin'],
[104] Fix | Delete
'default_on_child' => true,
[105] Fix | Delete
'tab_slug' => self::TAB_SLUG,
[106] Fix | Delete
'toggle_slug' => self::TOGGLE_SLUG,
[107] Fix | Delete
'mobile_options' => true,
[108] Fix | Delete
'hover' => 'tabs',
[109] Fix | Delete
'bb_support' => false,
[110] Fix | Delete
);
[111] Fix | Delete
[112] Fix | Delete
// For absolute position
[113] Fix | Delete
$additional_options['position_origin_a'] = $origin_option;
[114] Fix | Delete
$additional_options['position_origin_a']['linked_responsive'] = array( 'positioning', 'position_origin_f', 'position_origin_r' );
[115] Fix | Delete
[116] Fix | Delete
// For fixed position
[117] Fix | Delete
$additional_options['position_origin_f'] = $origin_option;
[118] Fix | Delete
$additional_options['position_origin_f']['linked_responsive'] = array( 'positioning', 'position_origin_a', 'position_origin_r' );
[119] Fix | Delete
[120] Fix | Delete
// For relative position
[121] Fix | Delete
$additional_options['position_origin_r'] = $origin_option;
[122] Fix | Delete
$additional_options['position_origin_r']['label'] = $i18n['offset']['label'];
[123] Fix | Delete
$additional_options['position_origin_r']['description'] = $i18n['offset']['description'];
[124] Fix | Delete
$additional_options['position_origin_r']['options'] = $corner_options;
[125] Fix | Delete
$additional_options['position_origin_r']['linked_responsive'] = array( 'positioning', 'position_origin_f', 'position_origin_a' );
[126] Fix | Delete
[127] Fix | Delete
// Offset options
[128] Fix | Delete
$offset_option = array(
[129] Fix | Delete
'type' => 'range',
[130] Fix | Delete
'range_settings' => array(
[131] Fix | Delete
'min' => -1000,
[132] Fix | Delete
'max' => 1000,
[133] Fix | Delete
'step' => 1,
[134] Fix | Delete
),
[135] Fix | Delete
'option_category' => 'layout',
[136] Fix | Delete
'default_unit' => 'px',
[137] Fix | Delete
'default_on_child' => true,
[138] Fix | Delete
'tab_slug' => self::TAB_SLUG,
[139] Fix | Delete
'toggle_slug' => self::TOGGLE_SLUG,
[140] Fix | Delete
'responsive' => true,
[141] Fix | Delete
'mobile_options' => true,
[142] Fix | Delete
'hover' => 'tabs',
[143] Fix | Delete
);
[144] Fix | Delete
[145] Fix | Delete
$additional_options['vertical_offset'] = $offset_option;
[146] Fix | Delete
$additional_options['vertical_offset']['default'] = $args['defaults']['vertical_offset'];
[147] Fix | Delete
$additional_options['vertical_offset']['label'] = $i18n['vertical']['label'];
[148] Fix | Delete
$additional_options['vertical_offset']['description'] = $i18n['vertical']['description'];
[149] Fix | Delete
[150] Fix | Delete
$additional_options['horizontal_offset'] = $offset_option;
[151] Fix | Delete
$additional_options['horizontal_offset']['default'] = $args['defaults']['horizontal_offset'];
[152] Fix | Delete
$additional_options['horizontal_offset']['label'] = $i18n['horizontal']['label'];
[153] Fix | Delete
$additional_options['horizontal_offset']['description'] = $i18n['horizontal']['description'];
[154] Fix | Delete
[155] Fix | Delete
$responsive_options += array(
[156] Fix | Delete
'vertical_offset',
[157] Fix | Delete
'horizontal_offset',
[158] Fix | Delete
'position_origin_a',
[159] Fix | Delete
'position_origin_f',
[160] Fix | Delete
'position_origin_r',
[161] Fix | Delete
);
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
if ( ! $args['hide_z_index_fields'] ) {
[165] Fix | Delete
$additional_options['z_index'] = array(
[166] Fix | Delete
'label' => $i18n['zindex']['label'],
[167] Fix | Delete
'description' => $i18n['zindex']['description'],
[168] Fix | Delete
'type' => 'range',
[169] Fix | Delete
'range_settings' => array(
[170] Fix | Delete
'min' => -500,
[171] Fix | Delete
'max' => 500,
[172] Fix | Delete
'step' => 1,
[173] Fix | Delete
),
[174] Fix | Delete
'option_category' => 'layout',
[175] Fix | Delete
'default' => $args['defaults']['z_index'],
[176] Fix | Delete
'default_on_child' => true,
[177] Fix | Delete
'tab_slug' => self::TAB_SLUG,
[178] Fix | Delete
'toggle_slug' => self::TOGGLE_SLUG,
[179] Fix | Delete
'unitless' => true,
[180] Fix | Delete
'hover' => 'tabs',
[181] Fix | Delete
'responsive' => true,
[182] Fix | Delete
'mobile_options' => true,
[183] Fix | Delete
);
[184] Fix | Delete
[185] Fix | Delete
$responsive_options += array(
[186] Fix | Delete
'z_index',
[187] Fix | Delete
);
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
foreach ( $responsive_options as $option ) {
[191] Fix | Delete
$additional_options["${option}_tablet"] = $skip;
[192] Fix | Delete
$additional_options["${option}_phone"] = $skip;
[193] Fix | Delete
$additional_options["${option}_last_edited"] = $skip;
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
return $additional_options;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
// Processing functions
[200] Fix | Delete
[201] Fix | Delete
/**
[202] Fix | Delete
* @param object $module Current module to be processed
[203] Fix | Delete
*/
[204] Fix | Delete
public function set_module( $module ) {
[205] Fix | Delete
$this->module = $module;
[206] Fix | Delete
}
[207] Fix | Delete
[208] Fix | Delete
/**
[209] Fix | Delete
* Interpreter of ET_Builder_Element::get_media_query
[210] Fix | Delete
*
[211] Fix | Delete
* @param string $view
[212] Fix | Delete
*
[213] Fix | Delete
* @return array
[214] Fix | Delete
*/
[215] Fix | Delete
public function get_media_query( $view ) {
[216] Fix | Delete
$media_query = array();
[217] Fix | Delete
if ( 'tablet' === $view ) {
[218] Fix | Delete
$media_query = array(
[219] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( 'max_width_980' ),
[220] Fix | Delete
);
[221] Fix | Delete
} elseif ( 'phone' === $view ) {
[222] Fix | Delete
$media_query = array(
[223] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( 'max_width_767' ),
[224] Fix | Delete
);
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
return $media_query;
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
/**
[231] Fix | Delete
* @param array $attrs
[232] Fix | Delete
* @param string $name
[233] Fix | Delete
* @param string $desktopDefault
[234] Fix | Delete
* @param string $view
[235] Fix | Delete
*
[236] Fix | Delete
* @return mixed
[237] Fix | Delete
*/
[238] Fix | Delete
private function get_default( $attrs, $name, $desktopDefault = '', $view = 'desktop' ) {
[239] Fix | Delete
$utils = ET_Core_Data_Utils::instance();
[240] Fix | Delete
$responsive = ET_Builder_Module_Helper_ResponsiveOptions::instance();
[241] Fix | Delete
$suffix = in_array( $view, array( 'tablet', 'phone' ) ) ? "_$view" : '';
[242] Fix | Delete
if ( 'hover' === $view ) {
[243] Fix | Delete
return $utils->array_get( $attrs, $name, $desktopDefault );
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
return $responsive->get_default_value( $attrs, "$name$suffix", $desktopDefault );
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
/**
[250] Fix | Delete
* @param array $attrs
[251] Fix | Delete
* @param string $name
[252] Fix | Delete
* @param string $default_value
[253] Fix | Delete
* @param string $view
[254] Fix | Delete
* @param bool $force_return
[255] Fix | Delete
*
[256] Fix | Delete
* @return mixed
[257] Fix | Delete
*/
[258] Fix | Delete
private function get_value( $attrs, $name, $default_value = '', $view = 'desktop', $force_return = false ) {
[259] Fix | Delete
$utils = ET_Core_Data_Utils::instance();
[260] Fix | Delete
$responsive = ET_Builder_Module_Helper_ResponsiveOptions::instance();
[261] Fix | Delete
$hover = et_pb_hover_options();
[262] Fix | Delete
$is_hover = 'hover' === $view;
[263] Fix | Delete
$field_device = $is_hover ? 'desktop' : $view;
[264] Fix | Delete
$field_name = $is_hover ? $hover->get_hover_field( $name ) : $name;
[265] Fix | Delete
$field_default = $is_hover ? $utils->array_get( $attrs, $name, $default_value ) : $default_value;
[266] Fix | Delete
[267] Fix | Delete
return $responsive->get_any_value( $attrs, $field_name, $field_default, $force_return, $field_device );
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
/**
[271] Fix | Delete
* Get exposed module settings for assisting layout block preview rendering
[272] Fix | Delete
*
[273] Fix | Delete
* @since 4.3.2
[274] Fix | Delete
*
[275] Fix | Delete
* @param string $function_name
[276] Fix | Delete
*
[277] Fix | Delete
* @return null|array
[278] Fix | Delete
*/
[279] Fix | Delete
public function get_layout_block_settings( $function_name ) {
[280] Fix | Delete
$position_fields = et_()->array_get( $this->module->advanced_fields, self::TOGGLE_SLUG, array() );
[281] Fix | Delete
$has_position_fields = is_array( $position_fields );
[282] Fix | Delete
[283] Fix | Delete
// Bail if current module has no position fields
[284] Fix | Delete
if ( ! $has_position_fields ) {
[285] Fix | Delete
return;
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
$props = $this->module->props;
[289] Fix | Delete
$responsive = et_pb_responsive_options();
[290] Fix | Delete
$hover = et_pb_hover_options();
[291] Fix | Delete
[292] Fix | Delete
// Position values
[293] Fix | Delete
$position = $responsive->is_responsive_enabled( $props, 'positioning' ) ?
[294] Fix | Delete
$responsive->get_property_values( $props, 'positioning', '', true ) :
[295] Fix | Delete
array(
[296] Fix | Delete
'desktop' => $responsive->get_desktop_value( 'positioning', $props ),
[297] Fix | Delete
);
[298] Fix | Delete
[299] Fix | Delete
if ( $hover->is_enabled( 'positioning', $props ) ) {
[300] Fix | Delete
$position['hover'] = $hover->get_value( 'positioning', $props );
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
// Bail if current module is not fixed positioning on any breakpoint/mode
[304] Fix | Delete
if ( ! in_array( 'fixed', $position ) ) {
[305] Fix | Delete
return;
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
// Position fixed origin values
[309] Fix | Delete
$position_fixed_origin = $responsive->is_responsive_enabled( $props, 'position_origin_f' ) ?
[310] Fix | Delete
$responsive->get_property_values( $props, 'position_origin_f', '', true ) :
[311] Fix | Delete
array(
[312] Fix | Delete
'desktop' => $responsive->get_desktop_value( 'position_origin_f', $props ),
[313] Fix | Delete
);
[314] Fix | Delete
[315] Fix | Delete
if ( $hover->is_enabled( 'position_origin_f', $props ) ) {
[316] Fix | Delete
$position_fixed_origin['hover'] = $hover->get_value( 'position_origin_f', $props );
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
// Vertical offset
[320] Fix | Delete
$vertical_offset = $responsive->is_responsive_enabled( $props, 'vertical_offset' ) ?
[321] Fix | Delete
$responsive->get_property_values( $props, 'vertical_offset', '', true ) :
[322] Fix | Delete
array(
[323] Fix | Delete
'desktop' => $responsive->get_desktop_value( 'vertical_offset', $props ),
[324] Fix | Delete
);
[325] Fix | Delete
[326] Fix | Delete
if ( $hover->is_enabled( 'vertical_offset', $props ) ) {
[327] Fix | Delete
$vertical_offset['hover'] = $hover->get_value( 'vertical_offset', $props );
[328] Fix | Delete
[329] Fix | Delete
// Offset rendering relies on origin position. Thus if position origin has
[330] Fix | Delete
// no hover value, set desktop as hover value to trigger adjustment rendering
[331] Fix | Delete
if ( ! isset( $position_fixed_origin['hover'] ) ) {
[332] Fix | Delete
$position_fixed_origin['hover'] = $position_fixed_origin['desktop'];
[333] Fix | Delete
}
[334] Fix | Delete
}
[335] Fix | Delete
[336] Fix | Delete
// Horizontal offset
[337] Fix | Delete
$horizontal_offset = $responsive->is_responsive_enabled( $props, 'horizontal_offset' ) ?
[338] Fix | Delete
$responsive->get_property_values( $props, 'horizontal_offset', '', true ) :
[339] Fix | Delete
array(
[340] Fix | Delete
'desktop' => $responsive->get_desktop_value( 'horizontal_offset', $props ),
[341] Fix | Delete
);
[342] Fix | Delete
[343] Fix | Delete
if ( $hover->is_enabled( 'horizontal_offset', $props ) ) {
[344] Fix | Delete
$horizontal_offset['hover'] = $hover->get_value( 'horizontal_offset', $props );
[345] Fix | Delete
[346] Fix | Delete
// Offset rendering relies on origin position. Thus if position origin has
[347] Fix | Delete
// no hover value, set desktop as hover value to trigger adjustment rendering
[348] Fix | Delete
if ( ! isset( $position_fixed_origin['hover'] ) ) {
[349] Fix | Delete
$position_fixed_origin['hover'] = $position_fixed_origin['desktop'];
[350] Fix | Delete
}
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
// Return current module's position and position origin settings
[354] Fix | Delete
return array(
[355] Fix | Delete
'position' => $position,
[356] Fix | Delete
'position_fixed_origin' => $position_fixed_origin,
[357] Fix | Delete
'vertical_offset' => $vertical_offset,
[358] Fix | Delete
'horizontal_offset' => $horizontal_offset,
[359] Fix | Delete
);
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
/**
[363] Fix | Delete
* @param string $function_name
[364] Fix | Delete
*/
[365] Fix | Delete
public function process( $function_name ) {
[366] Fix | Delete
$utils = ET_Core_Data_Utils::instance();
[367] Fix | Delete
$hover = et_pb_hover_options();
[368] Fix | Delete
$responsive = ET_Builder_Module_Helper_ResponsiveOptions::instance();
[369] Fix | Delete
$position_config = $utils->array_get( $this->module->advanced_fields, self::TOGGLE_SLUG, array() );
[370] Fix | Delete
$z_index_config = $utils->array_get( $this->module->advanced_fields, 'z_index', array() );
[371] Fix | Delete
[372] Fix | Delete
$props = $this->module->props;
[373] Fix | Delete
[374] Fix | Delete
$this->module->set_position_locations( array() );
[375] Fix | Delete
[376] Fix | Delete
if ( ! is_array( $z_index_config ) && ! is_array( $position_config ) ) {
[377] Fix | Delete
return;
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
$has_z_index = false;
[381] Fix | Delete
$has_position = false;
[382] Fix | Delete
[383] Fix | Delete
// z_index processing
[384] Fix | Delete
if ( is_array( $z_index_config ) ) {
[385] Fix | Delete
$z_index_selector = $utils->array_get( $z_index_config, 'css.main', '%%order_class%%' );
[386] Fix | Delete
$z_index_default = $utils->array_get( $z_index_config, 'default', '' );
[387] Fix | Delete
$z_important = $utils->array_get( $z_index_config, 'important', false ) !== false ? ' !important' : '';
[388] Fix | Delete
$views = array( 'desktop' );
[389] Fix | Delete
[390] Fix | Delete
if ( $hover->is_enabled( 'z_index', $props ) ) {
[391] Fix | Delete
array_push( $views, 'hover' );
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
if ( $responsive->is_responsive_enabled( $props, 'z_index' ) ) {
[395] Fix | Delete
array_push( $views, 'tablet', 'phone' );
[396] Fix | Delete
}
[397] Fix | Delete
[398] Fix | Delete
foreach ( $views as $type ) {
[399] Fix | Delete
$value = $this->get_value( $props, 'z_index', $z_index_default, $type, false );
[400] Fix | Delete
if ( '' !== $value ) {
[401] Fix | Delete
$type_selector = 'hover' === $type ? "${z_index_selector}:hover" : $z_index_selector;
[402] Fix | Delete
ET_Builder_Element::set_style( $function_name,
[403] Fix | Delete
array(
[404] Fix | Delete
'selector' => $type_selector,
[405] Fix | Delete
'declaration' => "z-index: $value$z_important;",
[406] Fix | Delete
'priority' => $this->module->get_style_priority(),
[407] Fix | Delete
) + $this->get_media_query( $type ) );
[408] Fix | Delete
$has_z_index = true;
[409] Fix | Delete
}
[410] Fix | Delete
}
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
if ( is_array( $position_config ) ) {
[414] Fix | Delete
$position_selector = $utils->array_get( $position_config, 'css.main', '%%order_class%%' );
[415] Fix | Delete
$position_default = $utils->array_get( $position_config, 'default', 'none' );
[416] Fix | Delete
$position_important = $utils->array_get( $position_config, 'important', false ) !== false ? ' !important' : '';
[417] Fix | Delete
$desktop_origin_value = 'top_left';
[418] Fix | Delete
[419] Fix | Delete
$views = array( 'desktop' );
[420] Fix | Delete
[421] Fix | Delete
if ( $hover->is_enabled( 'positioning', $props ) ) {
[422] Fix | Delete
array_push( $views, 'hover' );
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
if ( $responsive->is_responsive_enabled( $props, 'positioning' ) ) {
[426] Fix | Delete
array_push( $views, 'tablet', 'phone' );
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
$position_origins = array();
[430] Fix | Delete
foreach ( $views as $type ) {
[431] Fix | Delete
$value = $this->get_value( $props, 'positioning', $position_default, $type, true );
[432] Fix | Delete
$default_value = $this->get_default( $props, 'positioning', $position_default, $type );
[433] Fix | Delete
$important = in_array( $value, array( 'fixed', 'absolute' ) ) || ( 'desktop' != $type ) ? ' !important' : $position_important;
[434] Fix | Delete
$position_value = $value;
[435] Fix | Delete
if ( 'none' === $value ) {
[436] Fix | Delete
// none is interpreted as static in FE.
[437] Fix | Delete
$position_value = 'static';
[438] Fix | Delete
$important = ' !important';
[439] Fix | Delete
$position_origins[ $type ] = 'none';
[440] Fix | Delete
} else {
[441] Fix | Delete
$suffix = sprintf( "_%s", substr( $value, 0, 1 ) );
[442] Fix | Delete
$position_origins[ $type ] = $this->get_value( $props, "position_origin$suffix", 'top_left', $type, true );
[443] Fix | Delete
}
[444] Fix | Delete
if ( $default_value === $value ) {
[445] Fix | Delete
$position_origins[ $type ] .= '_is_default';
[446] Fix | Delete
}
[447] Fix | Delete
if ( strpos( $position_origins[ $type ], '_is_default' ) === false ) {
[448] Fix | Delete
$type_selector = 'hover' === $type ? "${position_selector}:hover" : $position_selector;
[449] Fix | Delete
ET_Builder_Element::set_style( $function_name,
[450] Fix | Delete
array(
[451] Fix | Delete
'selector' => $type_selector,
[452] Fix | Delete
'declaration' => "position: $position_value$important;",
[453] Fix | Delete
'priority' => $this->module->get_style_priority(),
[454] Fix | Delete
) + $this->get_media_query( $type ) );
[455] Fix | Delete
$has_position = true;
[456] Fix | Delete
}
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
$resp_status = array(
[460] Fix | Delete
'horizontal' => $responsive->get_responsive_status( $utils->array_get( $props, 'horizontal_offset_last_edited', false ) ),
[461] Fix | Delete
'vertical' => $responsive->get_responsive_status( $utils->array_get( $props, 'vertical_offset_last_edited', false ) ),
[462] Fix | Delete
);
[463] Fix | Delete
[464] Fix | Delete
$hover_status = array(
[465] Fix | Delete
'horizontal' => $hover->is_enabled( 'horizontal_offset', $props ),
[466] Fix | Delete
'vertical' => $hover->is_enabled( 'vertical_offset', $props ),
[467] Fix | Delete
);
[468] Fix | Delete
[469] Fix | Delete
if ( $resp_status['horizontal'] || $resp_status['vertical'] ) {
[470] Fix | Delete
if ( ! isset( $position_origins['tablet'] ) ) {
[471] Fix | Delete
$position_origins['tablet'] = $position_origins['desktop'];
[472] Fix | Delete
}
[473] Fix | Delete
if ( ! isset( $position_origins['phone'] ) ) {
[474] Fix | Delete
$position_origins['phone'] = $position_origins['desktop'];
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
if ( ( $hover_status['horizontal'] || $hover_status['vertical'] ) && ! isset( $position_origins['hover'] ) ) {
[479] Fix | Delete
$position_origins['hover'] = $position_origins['desktop'];
[480] Fix | Delete
}
[481] Fix | Delete
[482] Fix | Delete
$this->module->set_position_locations( $position_origins );
[483] Fix | Delete
[484] Fix | Delete
foreach ( $position_origins as $type => $origin ) {
[485] Fix | Delete
$type_selector = 'hover' === $type ? "${position_selector}:hover" : $position_selector;
[486] Fix | Delete
$active_origin = $origin;
[487] Fix | Delete
$is_default_position = false;
[488] Fix | Delete
$default_strpos = strpos( $origin, '_is_default' );
[489] Fix | Delete
if ( $default_strpos !== false ) {
[490] Fix | Delete
$is_default_position = true;
[491] Fix | Delete
$active_origin = substr( $origin, 0, $default_strpos );
[492] Fix | Delete
}
[493] Fix | Delete
if ( 'none' === $active_origin ) {
[494] Fix | Delete
if ( ! $is_default_position ) {
[495] Fix | Delete
ET_Builder_Element::set_style( $function_name,
[496] Fix | Delete
array(
[497] Fix | Delete
'selector' => $type_selector,
[498] Fix | Delete
'declaration' => "top:0px; right:auto; bottom:auto; left:0px;",
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function