Banner Slider

Introduction

Banner Slider is a Magento 2 extension for managing banner content in Admin and placing it on CMS pages or static blocks through a widget. It supports two display modes:

  • Carousel: Owl Carousel based slider mode (Luma) / Alpine.js carousel (Hyvä)
  • Stack: Ordered stacked layout mode

Packages

PackageComposer NameModule Name
Banner Slidercodingants/module-banner-sliderCodingAnts_BannerSlider
Banner Slider Hyväcodingants/module-banner-slider-hyvaCodingAnts_BannerSliderHyva

Requirements

  • PHP ~8.2.0 || ~8.3.0 || ~8.4.0
  • Magento 2.4.8 or compatible
  • codingants/module-core ^1.0
  • Hyvä module (for Hyvä package only): hyva-themes/magento2-theme-module ^1.4

Installation

Luma / Blank Theme

composer require codingants/module-banner-slider
bin/magento module:enable CodingAnts_BannerSlider
bin/magento setup:upgrade
bin/magento cache:flush

Hyvä Theme

Install both packages together:

composer require codingants/module-banner-slider codingants/module-banner-slider-hyva
bin/magento module:enable CodingAnts_BannerSlider CodingAnts_BannerSliderHyva
bin/magento setup:upgrade
bin/magento cache:flush

Upgrade

composer update codingants/module-banner-slider codingants/module-banner-slider-hyva
bin/magento setup:upgrade
bin/magento cache:flush

Configuration

Admin path:

  • Stores > Configuration > Coding Ants > Banner Slider

General Settings

FieldDescription
EnabledGlobally enable or disable the module. No frontend output when disabled.
Use Theme Owl CarouselIf enabled, the Banner Slider module will not load its own Owl Carousel JS/CSS assets. Use this if your theme already includes Owl Carousel. (Luma only; ignored on Hyvä)

License Configuration

FieldDescription
License KeyEnter the license key provided after purchase.
License StatusDisplays the current license validation status (read-only).
Update StatusDisplays the current update availability status (read-only).

Admin Usage

Admin menu entries (under Coding Ants > Banner Slider):

  • Sliders — Manage slider records
  • Banners — Manage banner records
  • Import / Export — Bulk data migration
  • Configuration — Shortcut to system configuration

Configuration page screenshot (Stores > Configuration > Coding Ants > Banner Slider)

Banner Slider Configuration

1. Create Banners First

Navigate to Coding Ants > Banner Slider > Banners and create banner records.

Banner edit actions:

  • Save Banner — Save the current banner and return to the grid
  • Save and Continue Edit — Save the current banner and stay on the same record
  • Save & Duplicate — Save the current banner, immediately create a duplicated banner, and open the new banner in edit mode. This is useful for quickly creating similar banners without repeating the same configuration. The duplicated banner keeps the current images, content, link settings, and associated sliders.
FieldRequiredDescription
EnabledActive status toggle
TitleBanner title, also used as image alt text
ImageDesktop banner image (jpg/jpeg/gif/png/webp, max 5 MB)
Mobile ImageOptional image for screens ≤ 768px. When set, a <picture> element with <source media="(max-width: 768px)"> is rendered automatically.
Link TypeControls how the banner links to target URL. Options:
None — No link
Entire — Entire banner is clickable; shows Link URL + Link Target
Button — CTA button; shows Link URL + Link Text + Link Target
Text — Text link; shows Link URL + Link Text + Link Target
Image — Image area only is clickable; shows Link URL + Link Target
Link URLTarget URL. Visible when Link Type ≠ None
Link TextButton / link label. Visible when Link Type = Button or Text
Link TargetNew Window (_blank) or Same Window (_self). Default: _blank
DescriptionDescription text displayed in the content overlay
BulletsSelling points, separated by semicolon ;
Content Max WidthMaximum width for the banner content area (default 1200px). Accepts CSS values like 800px, 100%, 80vw.
Content AlignmentUse default / Left / Center / Right / Hidden (Image Only). Default depends on mode: Carousel = center, Stack = left. Choosing Hidden renders image only with no overlay.
Sort OrderSort value for ordering
Associated SlidersMulti-select to associate this banner with one or more sliders

Banner List

Banner Edit

2. Create Sliders

Navigate to Coding Ants > Banner Slider > Sliders and create slider records.

Slider General Fields

FieldRequiredDescription
TitleSlider name
IdentifierUnique key used by widget rendering. Must be unique across all sliders. Use semantic names like home_hero, category_top.
ModeCarousel or Stack
Color SchemeLight or Dark. Controls the visual appearance of text, navigation elements, and overlay mask color.
Content Max WidthGlobal width constraint for the entire slider container (default 1240px). Accepts CSS values like 1240px, 100%, 80vw. This is the outer width; each banner also has its own Content Max Width for the text overlay area.
EnabledActive status

Slider List

Slider Edit

These fields apply when Mode = Carousel:

FieldDefaultDescription
Overlay TypeNoneAdds a semi-transparent mask to improve text readability. None — no overlay; Full — covers entire banner; Content — covers text area only.
Enable CSS AnimationNoControls optional frontend CSS animations for Carousel mode. Default is disabled. When enabled, the module applies the banner content entrance animation and image zoom animation on both Luma and Hyvä. On Hyvä, it also enables the slide track CSS transition.
AutoplayYesAuto-advance slides
Autoplay Timeout (ms)5000Interval between slides in milliseconds
Show NavYesShow previous/next arrows
Show DotsYesShow pagination dots
LoopYesLoop back to start when reaching the end
Margin20Gap between slides in pixels
Responsive ConfigFormat: 0:1;768:1;1024:2 (breakpoint:items). Meaning: viewport ≥ 0px → 1 item, ≥ 768px → 1 item, ≥ 1024px → 2 items. Invalid pairs are silently ignored.

Banners Selection

FieldDescription
Select BannersMulti-select to choose which banners to display. The saved selection order determines display order.

Frontend Placement

Insert a widget in a CMS page or static block:

  • Widget Type: Coding Ants Banner Slider
  • Slider: Select an existing slider by identifier

Widget Insert

Widget Insert

Frontend Carousel

Frontend Stack

Rendering rules:

  • Do not render when global Enabled = No
  • Do not render when the selected slider is missing or disabled
  • Render Carousel or Stack layout based on slider Mode

Option 2: Layout XML

To render a slider directly from layout XML:

<block class="CodingAnts\BannerSlider\Block\Slider\View"
       name="custom.banner.slider"
       template="CodingAnts_BannerSlider::widget/banner-slider.phtml">
    <arguments>
        <argument name="slider_identifier" xsi:type="string">home_main</argument>
    </arguments>
</block>

Hyvä Theme Compatibility

The CodingAnts_BannerSliderHyva module provides full Hyvä storefront support:

  • Template swap: The base Luma template is automatically replaced with a Hyvä-optimized template on hyva_default layout handles.
  • Alpine.js carousel: Replaces Owl Carousel with a pure Alpine.js implementation. CSP-compatible via $hyvaCsp->registerInlineScript().
  • CSS swap: Base module CSS is removed on Hyvä pages; Hyvä-specific styles (banner-slider-hyva.css) are loaded instead.
  • Animation toggle support: Slider field Enable CSS Animation is shared across Luma and Hyvä. When disabled, custom content entrance animations and image zoom effects are not applied. When enabled on Hyvä, the slide track CSS transition is also enabled.
  • Full feature parity: All features — carousel, stack, responsive item count, margin, autoplay, nav, dots, loop, overlay, color scheme, per-banner link modes, and mobile image — are supported.

No additional configuration is required. Installing the Hyvä package alongside the base package is sufficient.

Data Migration (Import / Export)

Navigate to Coding Ants > Banner Slider > Import / Export:

Import Export

  • Export All: Export sliders, banners, relations, and referenced images as a ZIP file
  • Import: Upload a ZIP exported by this module (must contain data.json; optional media/ folder)

Typical use cases:

  • Multi-environment synchronization (development / staging / production)
  • Site migration or rapid slider content replication

Best Practices

  • Use semantic identifiers such as home_hero or category_top
  • Verify both banners and sliders are enabled before go-live
  • Upload a dedicated mobile image for key banners to ensure good appearance on small screens
  • Use Color Scheme = Dark when banner backgrounds are light-colored, and vice versa
  • Use Overlay Type = Content or Full to improve text readability on busy images
  • Keep Enable CSS Animation disabled unless the project specifically wants animated slide content or image zoom effects
  • Clear cache and retest if frontend output is not updated
  • Maintain a consistent Responsive Config strategy across site breakpoints
  • Invalid width values are normalized to safe defaults by the module
  • If no valid link type is provided but a link URL exists, the module falls back to Entire