Container

Component Information

Component Title Container
Description The Container component allows for the creation of a container for multiple additional components on a page.
Features
  • Configurable layout type.
  • Configurable background image and background color:
    • Background images and colors can be enabled through policy configuration.
    • Color swatches for background color can be defined through policy configuration.
    • Background color can be restricted to only allow swatches through policy configuration.
  • Configurable HTML ID attribute.
  • Allowed components can be configured through policy configuration.
  • Style System support.
Location /apps/ehi-core/aem65/components/content/container/v1/container
sling:resourceSuperType /apps/core/wcm/components/container/v1/container
Supported AEM Versions 6.5
Editing Mode inPlaceEdit
Component Group Cheerios Experience
Use Object The Container component uses the com.adobe.cq.wcm.core.components.models.LayoutContainer Sling model as its Use-object.

 


BEM Description

BLOCK cmp-container


Extending the Components

Extending the components can be done in multiple ways depending on the needs of the brand component.

 

Use this approach if you do not have any required html markup changes or backend java changes. This will only update the title of the component, componentGroup and point to the resourceSuperType. Optionally can extend the description.

  1. Change .content.xml file properties 
  2. sling:resourceSuperType to point to the Cheer.IOs component [required]
  3. jcr:title - new Component title
  4. componentGroup - Brand specific Group [required]
  5. jcr:description - Helpful description

 

 

Use this approach if you need to update css classes or add data attributes and do not need to change the backend model, or potentially want to use a different model by retain all of the markup in the component-tmpl.html (Component Template) markup.

  1. Follow steps in Extend the Component - Basic
  2. Extend the file i.e. extend-example-option2.html
  3. Update file with new properties
  4. Update the html file with desired changes

 

 

The component template is usually named component-tmpl.html this file contains the html markup. Update this file if you need to change the html structure of the component.

  1. Follow Steps in Extend Component Basic
  2. Extend the file component.html to point to the new component-tmpl.html file
  3. Extend the file i.e. component-tmpl.html
  4. Update file with new markup

 

 

Use this approach if you need to change the Sling Model to update the backend logic.

Files that will need to be added when extending:

  1. Follow Steps in Extend Component - Basic
  2. Java Interface - this will implement the model with the new methods (if needed)
  3. Sling Model - this will implement the Java Interface from step 1 and leverage the sling delegation pattern to override the original methods
  4. The component.html file to match the new component name

It is possible to extend more than just the component.html file, if necessary any file that is resourceSupertyped can be extend for example if something needs added to the dialog.

This gives us the flexibility to change our classes or add attributes easily.  Say I want to add new javascript I can easily target a different data attribute to trigger my javascript.


Configuration Properties

Policy Properties

The following configuration properties are used:

  1. ./backgroundImageEnabled - defines whether to display a background image option.
  2. ./backgroundColorEnabled - defines whether to display a background color option.
  3. ./backgroundColorSwatchesOnly - defines whether or not to display swatches in the background color picker.
  4. ./allowedColorSwatches - defines a list of background color swatches that are allowed to be selected by an author.

It is also possible to define the allowed components for the Container.


Policy Configuration Visual

Edit Dialog Properties

The following properties are written to JCR for this Container component and are expected to be available as Resource properties:

Container Properties

  1. ./layout - defines the layout type, either simple (default) or responsiveGrid

Common Properties

  1. ./id - defines the component HTML ID attribute.
  2. ./backgroundImageReference - defines the container background image.
  3. ./backgroundColor - defines the container background color.

Enabling Container Editing Functionality

The following property is required in the proxy component to enable full editing functionality for the Container:

  1. ./cq:isContainer - set to {Boolean}true, marks the Container as a container component

Edit Dialog Visual



Component Demo

Fully Configured

The Container component allows for the creation of a container for multiple additional components on a page.

  1. jcr:primaryType: nt:unstructured
  2. jcr:createdBy: E524Z2
  3. jcr:lastModifiedBy: E524Z2
  4. jcr:created:
  5. jcr:lastModified:
  6. sling:resourceType: ehi-core/aem65/components/content/container/v1/container