Skip to content

feat: [Page Builder] Config: Elemental configuration, allowed block types per page#219

Open
jsirish wants to merge 1 commit intomainfrom
autopipe/issue-135
Open

feat: [Page Builder] Config: Elemental configuration, allowed block types per page#219
jsirish wants to merge 1 commit intomainfrom
autopipe/issue-135

Conversation

@jsirish
Copy link
Copy Markdown
Member

@jsirish jsirish commented Apr 1, 2026

Implements #135

Configuration

  • elemental.yml — Attaches ElementalAreasExtension to Page, enables CMS live preview
  • elemental-blocks.yml — Per-page-type block whitelists:
    • Page: ContentBlock, TextBlock, HTMLBlock, ImageBlock (base only)
    • LandingPage: Full palette (18+ blocks including CTA, Quote, Gallery, Hero, etc.)
    • ErrorPage: No blocks allowed
    • HomePage (optional): Curated subset

How to override

Blocks are configured via YAML. Additional PageTypes can add their own allowed_elements list to elemental-blocks.yml.

…ypes per page

- elemental.yml: attaches ElementalAreasExtension to Page, enables live preview
- elemental-blocks.yml: per-page-type block whitelists
  - Page: ContentBlock, TextBlock, HTMLBlock, ImageBlock
  - LandingPage: full palette (18+ block types including CTA, Quote, Gallery, Hero, etc.)
  - ErrorPage: no blocks
  - HomePage (optional): curated subset
- Documents available blocks and how to override

Relates to #133 (Page Builder system, issue #135)
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SilverStripe Elemental configuration to enable page-builder “blocks” and define per-page-type whitelists for which blocks can be added in the CMS (issue #135).

Changes:

  • Introduces app/_config/elemental.yml to attach Elemental to Page and enable live preview.
  • Introduces app/_config/elemental-blocks.yml to define allowed_elements per PageType (Page, LandingPage, ErrorPage, optional HomePage).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
app/_config/elemental.yml Adds global Elemental config (extension + block defaults + live preview).
app/_config/elemental-blocks.yml Adds per-page-type allowed_elements whitelists (including an optional HomePage override).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,32 @@
---
Name: elemental
After: framework/*, cms/*, elemental/*
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After: is written as a single scalar value containing commas (framework/*, cms/*, elemental/*). In YAML this won’t be treated as multiple ordering rules, so the config load order likely won’t behave as intended. Use a YAML list (multiple - entries) or a single After: target that matches an actual config name/anchor.

Suggested change
After: framework/*, cms/*, elemental/*
After:
- framework/*
- cms/*
- elemental/*

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +13
# Attach ElementalArea to standard Page
Page:
extensions:
- DNADesign\Elemental\Extensions\ElementalAreasExtension
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config unconditionally references Elemental classes (e.g. DNADesign\Elemental\Extensions\ElementalAreasExtension, DNADesign\Elemental\Models\BaseElement), but composer.json in this repo doesn’t require the Elemental module. Without gating (e.g. Only: { moduleexists: 'dnadesign/silverstripe-elemental' }) this can break dev/build when the module isn’t installed.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +28
App\PageBuilder\Blocks\ContentBlock:
allow_page_editing: true

App\PageBuilder\Blocks\TextBlock:
allow_page_editing: true

App\PageBuilder\Blocks\HTMLBlock:
allow_page_editing: true

App\PageBuilder\Blocks\ImageBlock:
allow_page_editing: true

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block classes configured here (App\PageBuilder\Blocks\ContentBlock, TextBlock, HTMLBlock, ImageBlock) don’t exist anywhere in this repository (no App\PageBuilder code is present). As-is, these settings won’t take effect and may lead to missing/empty block options. Either add these block classes, correct the namespaces to match existing classes, or remove the config until the blocks exist.

Suggested change
App\PageBuilder\Blocks\ContentBlock:
allow_page_editing: true
App\PageBuilder\Blocks\TextBlock:
allow_page_editing: true
App\PageBuilder\Blocks\HTMLBlock:
allow_page_editing: true
App\PageBuilder\Blocks\ImageBlock:
allow_page_editing: true

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,59 @@
---
Name: elemental-blocks
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file also unconditionally configures Elemental classes (allowed_elements includes DNADesign\Elemental\Models\* and many App\PageBuilder\Blocks\*), but the Elemental module isn’t declared in composer.json. Consider adding an Only: { moduleexists: 'dnadesign/silverstripe-elemental' } guard (or adding the dependency in this PR) to avoid config breaking when Elemental isn’t installed.

Suggested change
Name: elemental-blocks
Name: elemental-blocks
Only:
moduleexists: 'dnadesign/silverstripe-elemental'

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +43
# LandingPage — full palette of blocks
App\PageBuilder\LandingPage:
allowed_elements:
- App\PageBuilder\Blocks\ContentBlock
- App\PageBuilder\Blocks\TextBlock
- App\PageBuilder\Blocks\HTMLBlock
- App\PageBuilder\Blocks\ImageBlock
- App\PageBuilder\Blocks\CtaBlock
- App\PageBuilder\Blocks\QuoteBlock
- App\PageBuilder\Blocks\GalleryBlock
- App\PageBuilder\Blocks\HeroBlock
- App\PageBuilder\Blocks\AccordionBlock
- App\PageBuilder\Blocks\VideoBlock
- App\PageBuilder\Blocks\CalloutBlock
- App\PageBuilder\Blocks\PricingBlock
- App\PageBuilder\Blocks\TabsBlock
- App\PageBuilder\Blocks\StatsBlock
- App\PageBuilder\Blocks\FAQBlock
- App\PageBuilder\Blocks\FileDownloadBlock
- App\PageBuilder\Blocks\DividerBlock
- App\PageBuilder\Blocks\SpacerBlock
- DNADesign\Elemental\Models\ElementalContent
- DNADesign\Elemental\Models\TitleElement

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowed_elements references many App\PageBuilder\Blocks\* classes (and App\PageBuilder\LandingPage) that do not exist anywhere in this repository. With no corresponding PHP classes, the CMS “Add Block” dialog can end up empty or erroring depending on how Elemental resolves the whitelist. Update this list to only include classes that actually exist in the codebase, or land the block/page classes in the same PR.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +51
only:
'exists': 'App\Page\HomePage'
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional config block for App\Page\HomePage uses only: (lowercase) and an 'exists' condition key, which doesn’t match the existing conditional config pattern used elsewhere in this repo (Only: with keys like moduleexists, e.g. app/_config/mimevalidator.yml). As written, this condition is likely ignored, so the HomePage whitelist may apply unexpectedly or never apply. Use the standard Only: casing and a supported condition (e.g. class/module existence).

Suggested change
only:
'exists': 'App\Page\HomePage'
Only:
classexists: App\Page\HomePage

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,59 @@
---
Name: elemental-blocks
After: elemental/*
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this file is intended to override defaults set in app/_config/elemental.yml (Name: elemental), After: elemental/* does not guarantee ordering relative to that named config. Consider using After: '#elemental' (or otherwise explicitly ordering against the app config name) so the per-page whitelists reliably apply last.

Suggested change
After: elemental/*
After: '#elemental'

Copilot uses AI. Check for mistakes.
- App\PageBuilder\Blocks\ImageBlock

# LandingPage — full palette of blocks
App\PageBuilder\LandingPage:
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App\\PageBuilder\\LandingPage is configured here, but there is no LandingPage class under app/src in this repo. If the page type is expected to come from another module, ensure that module is required/autoloaded; otherwise this per-page whitelist will never take effect.

Suggested change
App\PageBuilder\LandingPage:
App\PageBuilder\LandingPage:
only:
'exists': 'App\PageBuilder\LandingPage'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants