Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-101246 Uses the Configuration to show or not show the contents sidebar panel #78113

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.layout.content.page.editor.web.internal.configuration;

import aQute.bnd.annotation.metatype.Meta;

import com.liferay.portal.configuration.metatype.annotations.ExtendedObjectClassDefinition;

/**
* @author Eudaldo Alonso
*/
@ExtendedObjectClassDefinition(generateUI = false)
@Meta.OCD(
id = "com.liferay.layout.content.page.editor.web.internal.configuration.ContentsContentPageEditorSidebarPanelConfiguration"
)
public interface ContentsContentPageEditorSidebarPanelConfiguration {

@Meta.AD(deflt = "false", required = false)
public boolean enabled();

}
Expand Up @@ -15,18 +15,24 @@
package com.liferay.layout.content.page.editor.web.internal.sidebar.panel;

import com.liferay.layout.content.page.editor.sidebar.panel.ContentPageEditorSidebarPanel;
import com.liferay.layout.content.page.editor.web.internal.configuration.ContentsContentPageEditorSidebarPanelConfiguration;
import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.util.ResourceBundleUtil;

import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Modified;

/**
* @author Eudaldo Alonso
*/
@Component(
configurationPid = "com.liferay.layout.content.page.editor.web.internal.configuration.ContentsContentPageEditorSidebarPanelConfiguration",
immediate = true, property = "service.ranking:Integer=400",
service = ContentPageEditorSidebarPanel.class
)
Expand Down Expand Up @@ -58,14 +64,23 @@ public boolean includeSeparator() {

@Override
public boolean isVisible(boolean pageIsDisplayPage) {

// LPS-100647

if (true) {
if (!_contentsContentPageEditorSidebarPanelConfiguration.enabled()) {
return false;
}

return !pageIsDisplayPage;
}

@Activate
@Modified
protected void activate(Map<String, Object> properties) {
_contentsContentPageEditorSidebarPanelConfiguration =
ConfigurableUtil.createConfigurable(
ContentsContentPageEditorSidebarPanelConfiguration.class,
properties);
}

private volatile ContentsContentPageEditorSidebarPanelConfiguration
_contentsContentPageEditorSidebarPanelConfiguration;

}