[#246] Added focal-point image style for banner featured image.#247
[#246] Added focal-point image style for banner featured image.#247AlexSkrypnyk wants to merge 4 commits into
Conversation
…ing on base-theme state.
…eability metadata bubbles.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a new Drupal image style ChangesBanner Featured Image
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Block as civictheme_banner Block
participant Preprocess as _drevops_preprocess_block__civictheme_banner
participant Helper as featured_image helper
participant Media as civictheme_media_image_get_variables
Block->>Preprocess: render banner block
Preprocess->>Helper: invoke featured image helper
Helper->>Helper: resolve node override or block media
Helper->>Helper: verify MediaInterface
Helper->>Media: request image variables
Media-->>Helper: return image variables
Helper-->>Preprocess: set featured_image variable
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Code coverage (threshold: 80%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #247 +/- ##
========================================
Coverage 89.16% 89.16%
========================================
Files 15 15
Lines 203 203
========================================
Hits 181 181
Misses 22 22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #246
Checklist before requesting a review
[#246] Verb in past tense.#246added to descriptionChangedsectionChanged
config/default/image.style.civictheme_banner_featured.yml— a newcivictheme_banner_featuredimage style ("Banner Featured Image") that appliesfocal_point_scale_and_cropat 800×800 withcrop_type: focal_point, followed byimage_converttowebp. Mirrors the existing focal-point styles (civictheme_slider_slide,civictheme_campaign) and the webp conversion used by thewidestyle. Thefocal_pointmodule was already enabled._drevops_preprocess_block__civictheme_banner__featured_image()inweb/themes/custom/drevops/includes/banner.inc— resolves the banner featured media (node-levelfield_c_n_banner_featured_imageoverrides block-levelfield_c_b_featured_image, mirroring CivicTheme's own resolution order) and appliescivictheme_media_image_get_variables($media, 'civictheme_banner_featured')so the focal-point-cropped derivative URL replaces the original. Thebuildrender array is passed to field lookups so cacheability metadata bubbles correctly. No-ops when there is no featured image.Previously the featured image was served at its original upload size and cropped by the browser via CSS
object-fit: cover, which centre-crops and ignores the editor-defined focal point. Moving the crop server-side via the focal-point style means the focal point is now honoured.Screenshots
Before / After
Summary by CodeRabbit