Is it possible to close all screens when the user presses the site logo on the header to achieve a “go to home page” effect?
You can close all windows using removeAll
method of Screens
bean (CUBA 7.0+), e.g:
@Inject
private Screens screens;
public void closeAll() {
screens.removeAll();
}
You need to create custom main window in order to add click listener to the logo image. The easiest way to do it - create corresponding screen (main window) in CUBA Studio:
public class ExtAppMainWindow extends AppMainWindow {
@Named
private Image logoImage;
@Override
public void init(Map<String, Object> params) {
super.init(params);
logoImage.addClickListener(clickEvent -> {
screens.removeAll();
});
}
}