Affects Version/s: 7.2.X
Component/s: Fragment Administration
There is a "Usages and Propagation" page that can be used to see where a given Fragment is used. This page categorizes the different usages by what type of page they are used on - for instance, a "Page", a "Page Template", or a "Display Page Template".
In 7.2.x and earlier, however, this categorization isn't working. Everything is categorizes as being under a Page even if it is actually being used on a Page Template or a Display Page Template.
The reason for this miscategorization is because query to count and get the entries from the FragmentEntryLink table for "Page Template" and "Display Page Template" mistakenly assumes that the classNameId of those FragmentEntryLink entries will correspond to the LayoutPageTemplateEntry class. However, this is a faulty assumption. We always store the Layout classNameId in the FragmentEntryLink table regardless of what type of page this FragmentEntryLink is associated with.
In 7.3.x and later, this issue is fixed by
LPS-115162, which adds a new plid column to the FragmentEntryLink table and adds new queries that join this new column with the relevant fields in the LayoutPageTemplateEntry table to find the FragmentEntryLinks that are associated with that particular type of page/template.
We cannot backport the entirety of
LPS-115162 since it adds a new column to the database. However, we can partially backport the relevant queries, making only slight modifications to them to use the existing classPK column rather than the new plid column, since the classPK column is always functioning as a plid in 7.2.x.
Steps to Reproduce
1. Start up Liferay and log in as the admin user.
2. Navigate to Site Administration > Pages > Page Fragments and create a new Collection.
3. In the new collection, create a new component.
4. Add the following html code to the component:
5. Navigate to Site Builder > Pages > Display Page Templates and add a new template (any content type will work)
6. Add the test component to the template and publish
7. Navigate back to Page Fragments, click on the three button menu on the test component, and select View Usages
Expected Result: The usages of the fragment are categorized under "Display Page Template"
Actual Result: The usages of the fragment are categorized under "Page"