QuestionQ14

Given a scenario, identify how to implement custom components and templates

A developer must create a new Title component. The requirements are:

  1. The layout must match the Title Core Component.
  2. The text property must use the page title as a prefix (for example, Page Title - <component text>).
  3. The component must be reusable.

Which approach is recommended?

  • A
    1. Create a Proxy Component of Title core component2. Create a Custom Sling Model that overrides the default behavior3. Customize the component template
  • B
    1. Create a custom component from scratch2. Create a Custom Sling Model for the component that follows the requirement3. Create a Model Exporter
  • C
    1. Create a Proxy Component from Title core component2. Create a Custom Sling Model that overrides the default behavior
Explanation

A site-specific proxy component inherits the Title Core Component through sling:resourceSuperType, preserving its layout while making the component reusable. A custom Sling Model can delegate to the inherited Title model and override the text value to prepend the current page title, without rewriting the Core Component or its template.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!