Skip to content

Commit

Permalink
fix: Preserve Data when duplicating Image or Link Portlet - MEED-7687 -
Browse files Browse the repository at this point in the history
Meeds-io/MIPs#165 (#247)

Prior to this change, when the Image or Link Portlet doesn't have been
initialized/displayed yet in a page, like the default Space Templates,
the 'data.init' preference isn't used to initialize the portlet yet and
thus when duplicating the page template, the 'data.init' has to be
reused instead of generated only when the CMS portlet is initialized.
  • Loading branch information
boubaker authored Oct 29, 2024
1 parent 46ad7f5 commit 2691604
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public String getPortletName() {
@SneakyThrows
public List<PortletInstancePreference> generatePreferences(Application application,
Portlet preferences) {
if (preferences != null && preferences.getPreference(DATA_INIT_PREFERENCE_NAME) != null) {
return Collections.singletonList(new PortletInstancePreference(DATA_INIT_PREFERENCE_NAME,
preferences.getPreference(DATA_INIT_PREFERENCE_NAME)
.getValue()));
}
String settingName = getCmsSettingName(preferences);
if (StringUtils.isBlank(settingName)) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public String getPortletName() {
@SneakyThrows
public List<PortletInstancePreference> generatePreferences(Application application,
Portlet preferences) {
if (preferences != null && preferences.getPreference(DATA_INIT_PREFERENCE_NAME) != null) {
return Collections.singletonList(new PortletInstancePreference(DATA_INIT_PREFERENCE_NAME,
preferences.getPreference(DATA_INIT_PREFERENCE_NAME)
.getValue()));
}
String settingName = getCmsSettingName(preferences);
if (StringUtils.isBlank(settingName)) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.exoplatform.commons.exception.ObjectNotFoundException;
import org.exoplatform.commons.utils.ExpressionUtil;
import org.exoplatform.portal.application.PortalRequestHandler;
import org.exoplatform.portal.application.PortalTemplateRequestHandler;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.SiteType;
Expand All @@ -62,6 +61,7 @@
import io.meeds.layout.model.NavigationCreateModel;
import io.meeds.layout.model.NavigationUpdateModel;
import io.meeds.layout.model.NodeLabel;
import io.meeds.portal.web.handler.PortalTemplateRequestHandler;

@Service
public class NavigationLayoutService {
Expand Down

0 comments on commit 2691604

Please sign in to comment.