Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Programmatically using page templates when creating layouts
I'm trying to create new layouts (pages) which I'm able to do using
LayoutLocalServiceUtil. But what I want to do is use the page
templates in Liferay 7.4 when creating these. I can list the page
templates with LayoutPageTemplateEntryLocalServiceUtil but I can't
find any information about how to use these for new layouts. Does
anybody have any information about it. The page template functionality
already present when creating new pages is what I'm trying to achieve,
which would be used for a custom resource. If you know where in the
sourcecode the add page using templates is this would be also useful.
EDIT: I´ve found that there is an ActionUtil.copyPrefrences
used in the sourcecode and there is
a com.liferay.layout.util.LayoutCopyHelper. i am using
LayoutCopyHelper right now and having some success, but not complete.
Ie if a view the page after creation, som of the template page parts
are there, but if i edit it, its empty again.So still a more complete
example would be nice, thank you.
EDIT2: For future reference: com.liferay.layout.util.LayoutCopyHelper copies the layout, but what is not mentioned anywhere is that if i want it to appear in the edit version of the created layout i need to copy the layout to the draft version of the layout. I would assume that if i copy to both the published and the draft version of the layout to get the elements in use right away.
Powered by Liferay™