Let us know by posting here.

Features Overview

Concrete's Features categorize functionality types in themes. They address specific issues in theme and block interactivity.

Block-Level CSS and JavaScript Challenges

Blocks in Concrete provide their own CSS and JavaScript, useful for interactivity. However, challenges include:

  1. Many blocks lead to multiple small JS and CSS file requests.
  2. Theme developers struggle to integrate custom support for core block types without conflicts.
  3. Shared code among blocks, like lightbox functionality, lacks easy customization options.
  4. Some blocks, like Calendar, have hard-coded JS libraries, limiting customization.
  5. Block-provided view.css files can't adapt to theme-specific CSS variables.

Concrete Features Solution

Features are logical groupings of shared functionality across blocks and pages. They ensure necessary JS and CSS are loaded as required. This system solves the above issues.

Examples of Core Features

  • Basics, Typography, Imagery, Calendar, Boards, Video, Maps

Implementing Features in Blocks

Blocks like Content, Gallery, Image Slider, Hero Image (using Imagery), Event List, Calendar (using Calendar feature) register required Features via UsesFeatureInterface.

Features Class Registry

The Concrete\Core\Feature\Features class lists all core features as constants.

Base/Fallback Assets

Feature-related JS and CSS, built into Concrete, are used unless overridden by theme-specific assets. Example: concrete/js/features/imagery/frontend.js for an Image Slider block.

Theme Features

Themes can specify supported features, bypassing the need for fallback assets. Example: Including Features::IMAGERY signals the theme provides necessary assets for Imagery feature.

Bedrock Theme Trait Features

Using BedrockThemeTrait in PageTheme automatically supports Basics and Typography. Themes can extend this to include additional features. Bedrock theme marks these features as supported, reflecting the theme's capabilities.

Implementing Additional Features

Themes can extend the basic features by overriding or extending getThemeSupportedFeatures method. Example: Adding Imagery feature support in a theme.

Implementing Imagery Feature

Why Add Imagery Feature?

  • Custom behaviors for Imagery blocks without default limitations.
  • Avoid loading unused/outdated JavaScript and CSS files for Imagery blocks.

Setting Up Testing Environment

  1. Add a new page to the theme.
  2. Include all block types with Imagery feature.

Current Imagery Blocks

  1. Image Slider
  2. Hero Image
  3. Gallery
  4. Lightbox feature image

Fallback assets are currently enabling these features.

Removing Fallback Assets

  1. Use getThemeSupportedFeatures in PageTheme class to stop loading fallback assets.
  2. Implement in PageTheme class:

    use Concrete\Core\Feature\Features;
    public function getThemeSupportedFeatures() {
        return [

Integrating Imagery SCSS and JavaScript

  1. Run npm run watch in theme directory.
  2. Add Imagery SCSS:
    • Create _imagery.scss in assets/scss/features/imagery.
    • Update main.scss to import _imagery.scss.
    • Include base Imagery SCSS from Bedrock.
  3. Customizing Imagery SCSS:
    • Choose specific SCSS directives (e.g., only for hero image and gallery).
    • SCSS variables automatically align with theme's variables.

Adding Imagery JavaScript

  1. Edit assets/js/main.js.
  2. Import Imagery JavaScript from Bedrock: javascript import '@concretecms/bedrock/assets/imagery/js/frontend';
  3. This aligns theme's JavaScript functionality with Imagery feature blocks.

Next Steps

  • Create custom interactions for Hero Image block using the Features system.

Implement Parallax Effect on Hero Images

Let’s enhance our Imagery suite's Hero Image block by adding a parallax effect using the Simple Parallax JavaScript library. This block, ideal for showcasing large images, will benefit greatly from this interactive feature.

Adding the Hero Image Block

First, add the Hero Image block to a page, noting any aesthetic issues like text visibility against the background image.


Customizing Hero Image with SCSS

To address aesthetic issues, particularly for themes favoring dark images, modify the block's appearance:

  • In _imagery.scss, import a new SCSS partial for the Hero Image block (_hero-image.scss).
  • In _hero-image.scss, add custom styles targeting the Hero Image block, adjusting text color to $body-bg and enhancing font size for better visibility.


Integrating Simple Parallax

  1. Installation: Use npm to install Simple Parallax:

    npm i simple-parallax-js

    This updates package-lock.json and downloads the library to node_modules/.

  2. Import in main.js: Add the following to main.js:

    import simpleParallax from 'simple-parallax-js';

    Then, apply the parallax effect specifically to .ccm-block-hero-image-image elements:

    var images = document.querySelectorAll('.ccm-block-hero-image-image');
    new simpleParallax(images, {scale: 1.5});

    After saving and running npm run production, the Hero Image block will display with the parallax effect.


Next Steps

With the Hero Image block improved, consider further enhancements, like modifying the behavior of the Image Slider block.

Simplifying Image Slider with Owl Carousel Library

Our goal is to revamp the Image Slider block using Owl Carousel for enhanced CSS and JavaScript control. This involves:

  1. Installing Owl Carousel and animate.css using npm.
  2. Replacing existing JavaScript and CSS imports in main.js and main.scss with Owl Carousel-specific ones, while removing unnecessary libraries.
  3. Adjusting the Image Slider block view template to align with Owl Carousel's requirements.


Install Libraries

Run in your theme directory:

npm i owl.carousel
npm i animate.css

Update JavaScript and CSS Imports

Remove the fallback Image Slider JavaScript in main.js and replace with:

import 'magnific-popup'
import '@concretecms/bedrock/assets/imagery/js/frontend/lightbox'
import '@concretecms/bedrock/assets/imagery/js/frontend/gallery'

// Owl Carousel
import 'owl.carousel'
    // Owl Carousel configuration

Update assets/scss/features/_imagery.scss to include Owl Carousel styles:

@import '~@concretecms/bedrock/assets/imagery/scss/frontend/lightbox/lightbox';
@import '~@concretecms/bedrock/assets/imagery/scss/frontend/gallery/gallery';
@import '~@concretecms/bedrock/assets/imagery/scss/frontend/hero-image';

// Owl Carousel
@import "~animate.css/animate";
@import "~owl.carousel/dist/assets/owl.carousel";
@import "~owl.carousel/dist/assets/owl.theme.default";

Customize Image Slider View Template

Create application/themes/flintstone/blocks/image_slide/view.php with Owl Carousel-specific markup, modifying concrete/blocks/image_slider/view.php accordingly.


The new setup offers a distinct look and enhanced functionality compared to the standard Concrete Image Slider.

Slider Demo


This exercise demonstrates the flexibility of the Concrete Features system in building custom themes with advanced functionalities.