Removing Default Document Types and Page Templates

Important: Liferay will support our API and resolve any issues and answer any questions having to do with the API itself or any other part of Liferay's software. Issues and questions regarding custom development may be handled by our Global Services team or by the developer of those customizations. 

This article documents how to remove the default Document Types and Page Templates that come with the Liferay platform. This article also describes the behavior in Liferay Portal where after deleting the default Document Types or Page Templates, they will reappear after restarting the portal.

How can you delete the default Document Types or Page Templates and have them stay deleted after subsequent restarts of the portal?

Resolution

In Liferay DXP 7.0 (patched with Fix Pack DE-12 and above)

To remove default document types in instances that are on Fix Pack DE-12 and above, go to System Settings > Collaboration > Documents & Media Service and uncheck Add Default Structures.

This functionality was introduced in Liferay DXP 7.0 starting with Fix Pack DE-12 (LPS-70331). If you are on a fix pack that was released before DE-12, please ensure that you have the latest fix pack installed to include this functionality into your Liferay DXP environment.

In Liferay Portal 6.2

To remove the default Document Types and Page Templates that come with Liferay Portal, simply go to the Documents and Media section of the Control Panel. Select “Manage” and then the Document Types option in the dropdown. Select the Actions Button and the Delete Option next to the Document Type to be removed.

To remove the default Page Templates, similarly navigate to the Page Templates section of the Control panel. Select the Actions Button and the Delete Option next to the Page Template to be removed.

If the portal is restarted, the Document Types and Page Templates will be repopulated. The reason that this occurs is because Liferay by default is designed to repopulate these Document Types and Page Template types at the restart of the Portal.

  1. One option for disabling the startup behavior is to modify the startup behavior through the application.startup.events property. It is possible to disable this behavior through the setting of a particular property. By default, the property is set as:
    application.startup.events=com.liferay.portal.events.AddDefaultDataAction,com.liferay.portal.events.AppStartupAction,com.liferay.portal.events.ChannelHubAppStartupAction

    Since com.liferay.portal.events.AddDefaultDataAction refers to the Java class that is called and repopulates the the Document Types and Page Templates when the server restarts, in order to keep the Document Types and Page Templates from repopulating, one solution would be to override the default behavior by removing the call to that property when restarting the portal. 

    An example of how the property can be modified so that the Document Types and Page Templates are not repopulated at restart of the portal would be to set the property as:

    application.startup.events=com.liferay.portal.events.AppStartupAction, \
    com.liferay.portal.events.ChannelHubAppStartupAction

    Do keep in mind that AddDefaultDataAction class does more than just add Document Types and Page Templates to the portal, so if turned off, those other desirable functions in AddDefaultDataAction will also not perform upon restart of the portal. 

  2. Since com.liferay.portal.events.AddDefaultDataAction does more then reset page and Document Types, another option would be to develop customization that only overrides the startup action that creates Document Types at startup of the portal.

LPS-37892 contains a new feature request to turn off default Document Types in the Documents and Media Library.

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助