Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script 'xfpage/customheaderlibs.html' fails when core page component is customised #1254

Open
krystian-panek-vmltech opened this issue Dec 4, 2024 · 0 comments

Comments

@krystian-panek-vmltech
Copy link

krystian-panek-vmltech commented Dec 4, 2024

Expected Behaviour

When doing page component customization based on:
https://experienceleague.adobe.com/en/docs/experience-manager-core-components/using/developing/customizing#customizing-the-logic-of-a-core-component

like this:

@Model(
        adaptables = SlingHttpServletRequest.class,
        adapters = Page.class,
        resourceType = {"acme/components/core/page"})
public class PageModel implements Page {

    @Self
    private SlingHttpServletRequest request;

    @Self
    @Via(type = ResourceSuperType.class)
    private Page page;
    
    // the rest of my customization
}

it has no chance to work on XFs which are assuming that xfpage is some kind of page , see:

because for regular pages we have:

resource type => {appId}/components/page
resource super type => core/wcm/components/page/v3/page (this is fine, allows delegation)

but for experience fragments:

resource type => {appId}/components/xfpage
resource super type => cq/experience-fragments/components/xfpage (this is not correct, the super type is not core component page so that Sling Models injection will fail)

Wrapping up, I am expecting that AEM project structure generated from archetype will allow customisation of any core components without side effects like I just described related to XFs.

Probably 'customheaderlibs.html' and 'customfooterlibs.html' just have to load htmlPageItems on their own (not reusing core components page Java logic to fix the problem.

Actual Behaviour

AEM project files generated from the archetype setup do not allow following the Core Components documentation regarding the extendability of the Core Page Component without fixing the XF problem on their own.

Platform and Version

Recent archetype files (51)

Logs taken while reproducing problem

org.apache.sling.scripting.sightly.SightlyException: Identifier com.acme.aem.core.components.page.PageModel cannot be correctly instantiated by the Use API
	at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:76) [org.apache.sling.scripting.sightly:1.4.22.140]
	at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:72) [org.apache.sling.scripting.sightly:1.4.22.140]
	at org.apache.sling.scripting.sightly.apps.acme.components.xfpage.customheaderlibs__002e__html.render(customheaderlibs__002e__html.java:72)
	at org.apache.sling.scripting.sightly.render.RenderUnit.render(RenderUnit.java:53) [org.apache.sling.scripting.sightly.runtime:1.2.6.140]
	at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61) [org.apache.sling.scripting.sightly:1.4.22.140]
	at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:393) [org.apache.sling.scripting.core:2.4.8]
@krystian-panek-vmltech krystian-panek-vmltech changed the title Custom header/footer script fails on XF when page component is customized Script 'xfpage/customheaderlibs.html' fails when core page component is customised Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant