Skip to content

Update Slide to use natural TitleShowTitle field naming#40

Closed
jsirish wants to merge 2 commits into
2from
feature/slide-textcheckboxgroupfield
Closed

Update Slide to use natural TitleShowTitle field naming#40
jsirish wants to merge 2 commits into
2from
feature/slide-textcheckboxgroupfield

Conversation

@jsirish
Copy link
Copy Markdown
Member

@jsirish jsirish commented Sep 3, 2025

Summary

Updates the Slide class to use natural TitleShowTitle field naming by modifying the TextCheckboxGroupField creation approach, ensuring consistency with BaseElementObject and enabling proper integration with CustomStylesExtension.

Changes Made

🎯 Natural Field Naming Implementation

  • Modified: TextCheckboxGroupField::create('Title') instead of ->setName('Title')
  • Result: Field name becomes TitleShowTitle naturally (SilverStripe framework behavior)
  • Consistency: Matches BaseElementObject pattern exactly

🔧 Technical Improvements

  • Maintained class existence check - graceful fallback when TextCheckboxGroupField is not available
  • Preserved backward compatibility - existing data and functionality unchanged
  • Aligned with framework conventions - uses parameter-based field creation

Integration Context

This change is part of a coordinated update across three repositories to implement unified TitleShowTitle field naming:

  1. essentials-tools: Updated CustomStylesExtension to position fields using TitleShowTitle for BaseElementObject descendants
  2. baseobject: Updated field creation to generate TitleShowTitle naturally (PR #39)
  3. 📋 carousel (this PR): Updated Slide class to match the unified pattern

Technical Details

Before

TextCheckboxGroupField::create()
    ->setName('Title')
    ->setTitle($this->fieldLabel('Title'))

After

TextCheckboxGroupField::create('Title')
    ->setTitle($this->fieldLabel('Title'))

Architecture Benefits

  • Unified Field Naming: All BaseElementObject descendants now use TitleShowTitle consistently
  • Framework Alignment: Uses SilverStripe's natural field naming behavior instead of manual override
  • Extension Compatibility: Works seamlessly with CustomStylesExtension dynamic positioning logic

Background

This approach was chosen after architectural review of the original implementation. The unified approach ensures:

  • Consistency: All BaseElementObject descendants use the same field naming pattern
  • Natural Behavior: Leverages SilverStripe framework conventions
  • Future-Proof: Any new field positioning logic will work consistently across all descendants

Backwards Compatibility

  • Impact: Changes field name from Title to TitleShowTitle for Slide objects
  • Timeline: Affects projects from the last 12 months (manageable scope)
  • Assessment: Coordinated with BaseElementObject changes for unified rollout
  • Mitigation: Clear documentation and coordinated release strategy

Testing

  • ✅ Title field displays as combined Title/ShowTitle field in CMS
  • ✅ Field name becomes TitleShowTitle naturally through framework behavior
  • ✅ TopTitle field appears correctly before TitleShowTitle field (via CustomStylesExtension)
  • ✅ Existing Slide data preserved and functional
  • ✅ Graceful fallback when TextCheckboxGroupField unavailable

Related PRs


Ready for review. This change completes the unified TitleShowTitle field naming implementation across all BaseElementObject descendants.

- Add TextCheckboxGroupField import and implementation in Slide::getCMSFields()
- Match BaseElementObject Title field pattern for consistency
- Remove ShowTitle from removeByName array (handled by TextCheckboxGroupField)
- Add fallback for when TextCheckboxGroupField class doesn't exist
- Ensures consistent Title/ShowTitle behavior across BaseElementObject descendants

Aligns with TopTitle consolidation in essentials-tools CustomStylesExtension.
Copilot AI review requested due to automatic review settings September 3, 2025 16:46
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

This PR standardizes the Title field implementation in the Slide class to match the pattern used in BaseElementObject descendants, ensuring consistent CMS behavior and compatibility with TopTitle functionality from the CustomStylesExtension.

  • Fixes TextCheckboxGroupField instantiation to use proper fluent interface pattern
  • Ensures consistent Title/ShowTitle field behavior across all BaseElementObject descendants
  • Enables TopTitle field positioning to work correctly via CustomStylesExtension

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Use TextCheckboxGroupField::create('Title') instead of ->setName('Title')
- This creates 'TitleShowTitle' field name naturally
- Matches BaseElementObject pattern for consistency
- Part of unified approach across all BaseElementObject descendants
@jsirish jsirish changed the title Implement TextCheckboxGroupField for consistent Title field pattern Update Slide to use natural TitleShowTitle field naming Sep 3, 2025
@jsirish jsirish closed this Sep 3, 2025
@jsirish jsirish deleted the feature/slide-textcheckboxgroupfield branch September 3, 2025 17:11
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