pnpcore
pnpcore copied to clipboard
Flexible Sections: Change a page title for a page that has flexible section disrupts the page structure
Category
- [x] Feature request
Describe the feature
Flexible sections seem unsupported when using PnPCore in modern pages. Changing only the page title in a page with flexible sections disrupts the page structure.
I'm developing a custom translation solution for modern pages, which works well with regular pages. However, it fails with pages that have flexible sections.
My technical approach involves locating the text web parts in the page and translating them to the respective language. On pages with flexible sections, changing just the page title disrupts the page structure.
Describe the solution you'd like
Could you please let me know if the flexible sections are supported or can be controlled, and if there are any tips or tricks I should be aware of?
Additional context
var page = pages.First();
if (page != null)
{
page.PageTitle = PageControls.PageTitle;
await page.SaveAsync();
await page.PublishAsync();
}
Flex sections are not recognized, so they default to one column sections. Work is underway to support flexible sections: #1632
Tested your case with the code in pull request https://github.com/pnp/pnpcore/pull/1670 and it worked for me
Thanks for the fix @czullu , I just merged your PR!
@mohammadamer : FYI.
Hey @jansenbe
I'm using PnP.Core 1.15.0 but unfortunately got the following errors:
CanvasSectionTemplate' does not contain a definition for 'FlexibleLayoutVerticalSection
The name 'ZoneReflowStrategy' does not exist in the current context
in the following line, it looks like I'm using the wrong SDK version. Isn't it the latest version?
newPage.AddSection(CanvasSectionTemplate.FlexibleLayoutVerticalSection, 1, zoneReflowStrategy: ZoneReflowStrategy.LeftToRight);
myproject.csproj
<PackageReference Include="PnP.Core" Version="1.15.0" />