Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Deep diving into Sling models PT6 | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Deep diving into Sling models PT6 by Digitalum

Abstract

The final chapter: Customizing AEM Core Components
Nowadays you won’t find a lot of projects anymore that don’t make use of the AEM Core Components, and with good reason. The core components provide some nice out-of-the-box functionalities and best practices that help to decrease the development effort required to build a website. If you haven’t already, you can find documentation here (https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html) and the open source git repository here (https://github.com/adobe/aem-core-wcm-components).

Because we make so much use of them, we often find ourselves creating overlays for these components to extend their look & feel, but what if we want to modify the underlying backend code? In this blog post we’ll discuss how we can do that, using the Sling delegation pattern.

Please note that in order to make use of this feature, you need to have the Sling Models API 1.3.4 or higher and the Sling Models Impl 1.4.0 or higher.

When would we want to use this?
Imagine the following scenario: you must build a component to share your pages on social media. Great! Nothing we must do for that, because there is a sharing component in the core components.

Unfortunately for you, the business wants people to be able to share on Facebook and Twitter and the default implementation only works for Facebook and Pinterest. You don’t want to create a model to just copy/paste whatever was made in the core components project and add your own logic to that. To prevent us from having to do this, the Sling delegation pattern comes to the rescue.

So how does it work?
The Sling delegation pattern is used to inject an instance of our super type model into the current model. This means that we can create a model that extends from our resourceSuperType’s model and add our own custom logic to that.

Read Full Blog

Deep diving into Sling models PT6

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies