Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E134 Topic 6 Question 44 Discussion

Actual exam question for Adobe's AD0-E134 exam
Question #: 44
Topic #: 6
[All AD0-E134 Questions]

An AEM Developer needs to create a new component to help support a new product launch.

* The client is on AEM 6.5 on-premise with the latest version of WCM Core Components

* The component must include text, image, and a link

* The component must support multiple designs

Which process should the AEM Developer use to support the launch?

Show Suggested Answer Hide Answer
Suggested Answer: C

To implement a new component called 'Page Headline' which takes the text from the current page title instead of jcr:title, you should create a proxy component from the core title component and implement a Sling Model accordingly. Option C demonstrates the correct approach to achieve this functionality.

Here is a detailed explanation of Option C:

Create Proxy Component:

Create a new component in your project that will act as a proxy to the core title component. This involves creating a new component node in the repository that inherits from the core title component.

Example path: /apps/myproject/components/pageHeadline with sling:resourceSuperType set to core/wcm/components/title/v2/title.

Implement Sling Model:

Implement a Sling Model that adapts from SlingHttpServletRequest and Title.class, ensuring it overrides the text fetching logic to retrieve the title from the current page's title.

The model will use @ScriptVariable to inject the current page and @Self to access the core title component's logic.

@Model(adaptables = SlingHttpServletRequest.class, adapters = Title.class, resourceType = 'myproject/components/pageHeadline')

public class PageHeadline implements Title {

@ScriptVariable

private Page currentPage;

@Self @Via(type = ResourceSuperType.class)

private Title title;

@Override

public String getText() {

return currentPage.getTitle();

}

@Override

public String getType() {

return title.getType();

}

}

@Model Annotation: Specifies that this class is a Sling Model and adapts from SlingHttpServletRequest. It is also an adapter for Title.class and applies to the myproject/components/pageHeadline resource type.

@ScriptVariable: Injects the current Page object, which allows access to the current page's properties.

@Self @Via(type = ResourceSuperType.class): Injects the core title component, allowing the reuse of existing logic.

getText() Method: Overrides the getText() method to return the title from the current page instead of the jcr:title.

getType() Method: Delegates to the core title component's getType() method to maintain existing functionality.

This approach leverages the power of Sling Models and the core components to extend functionality while keeping the implementation clean and maintainable.


Adobe Experience Manager - Core Components

Sling Models Documentation

Contribute your Thoughts:

Alyce
26 days ago
Honestly, I just want an option that involves the least amount of work. Can we just slap a few images and links onto the existing Text Component and call it a day? No? Darn, guess I'll have to put in some effort after all.
upvoted 0 times
...
Shenika
1 months ago
Bingo! Creating a new Image with Text component and using the Core Components authoring dialogs is the way to go. This gives us a custom component that's tailored to our needs, while still leveraging the power of the Core Components. Plus, the policy for defining designs is the icing on the cake.
upvoted 0 times
Vallie
1 days ago
C: Add a policy to define which designs are used
upvoted 0 times
...
Dalene
3 days ago
B: Create a new Image with Text component that exposes the Core Components authoring dialogs for those components
upvoted 0 times
...
Darrel
22 days ago
A: Extend the Teaser Component from Core Components
upvoted 0 times
...
...
Tayna
2 months ago
Hmm, I'm not sure enabling image manipulations on the Text Component is the best solution. That might be a bit of a hack, and I'd be worried about the maintainability of the component. I think option B or D would be a cleaner approach.
upvoted 0 times
Lashon
22 days ago
Yeah, enabling image manipulations on the Text Component does seem like a bit of a hack.
upvoted 0 times
...
Sherell
26 days ago
I agree, option B or D would definitely be a cleaner approach.
upvoted 0 times
...
...
Shanda
2 months ago
I prefer option D because it involves creating a new Image with Text component that exposes the Core Components authoring dialogs.
upvoted 0 times
...
Christoper
2 months ago
Creating a new component by extending the Text Component seems like the most straightforward approach. We can add the image and link functionality without too much hassle. Plus, the Style System should give us the design flexibility we need.
upvoted 0 times
...
Nakita
2 months ago
Ah, this is a tricky one! Extending the Teaser Component from Core Components sounds like a good option, but I'm not sure if that will give us the flexibility we need for multiple designs. Maybe option D would be better to really customize the component for our needs?
upvoted 0 times
Louis
34 minutes ago
Let's go with option D then, it seems like the most customizable solution for our new product launch.
upvoted 0 times
...
Katie
3 days ago
Creating a new Image with Text component and defining designs with a policy seems like a solid approach.
upvoted 0 times
...
Billye
12 days ago
I agree, extending the Teaser Component may not give us the flexibility we need for this project.
upvoted 0 times
...
Izetta
1 months ago
I think option D would be the best choice for customizing the component to support multiple designs.
upvoted 0 times
...
...
Eveline
2 months ago
I agree with you, Selma. Option A also allows for creating style variations to support multiple designs.
upvoted 0 times
...
Selma
2 months ago
I think option A is the best choice because it involves extending the Teaser Component from Core Components.
upvoted 0 times
...

Save Cancel