feat: add displaySubtitle to card#100
Conversation
Composer package changes
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Sage theme’s query-block card rendering to support the new displaySubtitle option introduced in yard/query-block (per linked upstream PR), and wires that option through to the card component.
Changes:
- Pass
displaySubtitlefrom the query-block’sBlockAttributesinto<x-dynamic-card>for both default and horizontal templates. - Add
displaySubtitlesupport to the theme’sCardcomponent and conditionally render the subtitle based on it. - Bump
yard/query-blockincomposer.locktov1.5.0.
Reviewed changes
Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/app/themes/sage/resources/views/vendor/yard-query-block/templates/horizontal.blade.php | Passes displaySubtitle through to the dynamic card in the horizontal query-block layout. |
| web/app/themes/sage/resources/views/vendor/yard-query-block/templates/default.blade.php | Passes displaySubtitle through to the dynamic card in the default query-block layout. |
| web/app/themes/sage/resources/views/components/card.blade.php | Only renders the subtitle when displaySubtitle is enabled. |
| web/app/themes/sage/app/View/Components/Card.php | Adds displaySubtitle prop and defaulting logic to the Card component. |
| composer.lock | Updates yard/query-block to v1.5.0 (but also includes additional lockfile metadata changes). |
There was a problem hiding this comment.
LGTM
Extended reasoning...
Overview
This PR adds a displaySubtitle boolean prop to the Card component, following the exact same pattern already used by displayDate, displayExcerpt, displayImage, and displayLabel. The change consists of: adding the constructor parameter in Card.php, setting its default to true in setDisplayDefaults(), updating the blade template to gate the subtitle output on the flag, and threading the new attribute through both query-block templates. The composer.lock bump upgrades yard/query-block from v1.4.1 to v1.5.0, which is the upstream package that introduced the displaySubtitle() method being called here.
Security risks
No security risks. The subtitle value is rendered with {\!\! $subtitle \!\!} (unescaped), but this was already the case before this PR — the new code only adds an additional boolean guard, it does not change the escaping behaviour.
Level of scrutiny
Low. This is a purely mechanical, pattern-following addition of one optional feature flag. Every line of the change mirrors an existing prop (displayLabel) with no novel logic.
Other factors
No bugs were reported by the bug hunting system. The change is small, self-contained, and consistent with the established conventions in the codebase.
Het query block heeft een extra optie gekregen (yardinternet/wp-query-block#142) dus in deze PR wordt dat toegepast.