FIX SS6 template compatibility - remove $TitleTag references#16
Merged
Conversation
- Remove references to $TitleTag and $TitleSizeClass from template - These variables are from wedevelopnl/silverstripe-elemental-grid which is not compatible with SS6 - Change to standard h2 heading tag with element__title class - Fixes broken HTML rendering in SilverStripe 6
There was a problem hiding this comment.
Pull Request Overview
This PR fixes SilverStripe 6 compatibility issues in the ElementCard template by removing dependency on the incompatible wedevelopnl/silverstripe-elemental-grid package variables.
- Replaced dynamic title tag variables (
$TitleTag,$TitleSizeClass) with hardcoded<h2>element - Ensures proper HTML rendering on the frontend by removing broken template syntax
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <div class="card-body h-100 d-flex align-items-center"> | ||
| <div> | ||
| <% if $Title && $ShowTitle %><$TitleTag class="element__title $TitleSizeClass">$Title</$TitleTag><% end_if %> | ||
| <% if $Title && $ShowTitle %><h2 class="element__title">$Title</h2><% end_if %> |
There was a problem hiding this comment.
[nitpick] Hardcoding the title as <h2> may create heading hierarchy issues if this element is nested within other sections. Consider whether the heading level should be configurable or if semantic HTML structure is maintained across the page.
Suggested change
| <% if $Title && $ShowTitle %><h2 class="element__title">$Title</h2><% end_if %> | |
| <% if $Title && $ShowTitle %> | |
| <% if $HeadingLevel %> | |
| <h{$HeadingLevel} class="element__title">$Title</h{$HeadingLevel}> | |
| <% else %> | |
| <h2 class="element__title">$Title</h2> | |
| <% end_if %> | |
| <% end_if %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes ElementCard template for SilverStripe 6 compatibility by removing incompatible
$TitleTagand$TitleSizeClassvariables fromwedevelopnl/silverstripe-elemental-gridpackage.Changes
<$TitleTag class="element__title $TitleSizeClass">$Title</$TitleTag><h2 class="element__title">$Title</h2>Reason
The
$TitleTagand$TitleSizeClassvariables come from thewedevelopnl/silverstripe-elemental-gridpackage which is not yet compatible with SilverStripe 6. Using these variables caused broken HTML output showing raw template syntax on the frontend.Testing
Related