elementor / elementor/elementor

Responsive => true on update_control not really make responsible

Open
#15,957 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
7.1k
Forks
1.6k
Avg merge
1d 5h
Merged PRs (30d)
193

Description

## Prerequisites

- [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [x] The issue still exists against the latest stable version of Elementor.

## Description

I'm trying do update control of widget Slides to make tha background image be responsive, I'm using this code:

```
add_action( 'elementor/element/slides/section_slides/before_section_end', function( $widget, $args ) {

$control_data = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $widget->get_unique_name(), "slides" );
if ( is_wp_error( $control_data ) ) {
return;
}

$control_data['fields']['background_image']['responsive'] = true;
$control_data['fields']['background_image']['selectors'] = [
'{{WRAPPER}} {{CURRENT_ITEM}} .swiper-slide-bg' => 'background-image: url("{{URL}}")'
];

$widget->update_control( 'slides', $control_data );
}, 10, 2 );
}
```

The "responsive" appears, but this not really change the control. When I'm toggle to mobile, the same image appears of the desktop, and if I change on mobile the same image appears on desktop.

![image](https://user-images.githubusercontent.com/18134442/129083041-a0ad54e7-e4d0-489e-bd08-f256ee8dd83d.png)

I made an own search to change the add_control to add responsive control in an update way, but didn't find.

## Steps to reproduce

Add code above in a plugin/functions.php and try to set different images on Slides repeater.

## Isolating the problem

- [x] This bug happens with only Elementor plugin active (and Elementor Pro).
- [x] This bug happens with a default WordPress theme active.
- [x] I can reproduce this bug consistently using the steps above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.