Uploaded image for project: 'PUBLIC - Liferay Documentation'
  1. PUBLIC - Liferay Documentation
  2. LRDOCS-5887

Document current behaviour of the Settings Scope in 7.0 and 7.1, and a upgrade path for the affected 6.2 embedded portlets

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: 7.0.x, 7.1.x
    • Component/s: Developer Network
    • Labels:
      None
    • Type of Documentation:
      Developer: Development Frameworks

      Description

      Changes for the dev.liferay.com.

      Change #1

      Describe how the settingsScope of the embedded portlets via runtime tag currently works:

      The current documentation is here:
      https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/embedding-portlets-in-themes-and-layout-templates#setting-default-preferences-for-an-embedded-portlet

      https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/embedding-portlets-in-themes-and-layout-templates#setting-default-preferences-for-an-embedded-portlet

      And we need to add something like this:

      settingsScope: Specifies which settings to use for the application. The default value is portletInstance, but it can be set to group or company. 
      
      Important: This attribute is currently deprecated (LPS-87434) and only works for the scope group, independently of the selected value. A configuration per layout can be obtained using a differrent instanceId in each page/layout, for example appending the plid to a constant to get a complete instanceId. 
      
      As the preferences/settings for embedded applications has been force to use the group scope, projects upgrading from 6.2 (or prior versions) and working with preferences unique per layout for these type of portlets, will need to perform an upgrade path in the version 7 if the old behaviour want to be kept.
      

      Change #2 New upgrade path

      7 embedded portlets store their configuration/settings in the scope group, this means that all portlets with the same portletInstanceId shared their configuration between the different pages of the same web site. This was not the 6.2 and previous versions behaviour, and if the portlet has preferences owned by layout, al the embedded portlets have a configuration per page. So, if you want to maintain the old behaviour you need to use different instanceId for embed the portlet in each page. 
      
      So, this upgrade path can not be automatized because depends on the code for embedding the portlet. The idea will be to append the plid to the previous instanceId and convert the previous configuration in the new one.
      
      1. Add the plid to the instanceId coming from the previous version, for example if the portlet is the Web Content Display (old portletId: 56) and the instanceId is "FOOTER", the portlet should be embedded in 7.x as follow:
      
      <@liferay_portlet["runtime"]
          instanceId="FOOTER${plid}"
          portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"
      />
      
      2. After complete the data base upgrade process, configure the embedded portletIds list in the attached groovy script, look for the getOldEmbeddedPortletIds() method, the portletIds need to have the format {newRootPortletId}_INSTANCE_{oldInstanceId}, so, for the previos example the portletId will be: com_liferay_journal_content_web_portlet_JournalContentPortlet_INSTANCE_FOOTER
      
      Create a data backup (data base, document library, etc), start the server and run the groovy script from Control Panel > Server Administration > Script , and selecting groovy as language. The script process the embedded portlet list and transform the preferences in order to work with the new approach based in use a different instanceId per page.
      
      3. Deploy the theme with the changes for embedding the portlets with the instanceId+plid and verify that works as expected (loading the "upgraded" configuration"
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jose.jimenez Jose Jimenez
                Reporter:
                jose.jimenez Jose Jimenez
                Participants of an Issue:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Packages

                  Version Package
                  7.0.x
                  7.1.x