Skip to content

feat: add Helpers::formatAnnouncement() for announcement-bar ACF group#67

Merged
parisek merged 1 commit into
mainfrom
feat/format-announcement-helper
Jul 4, 2026
Merged

feat: add Helpers::formatAnnouncement() for announcement-bar ACF group#67
parisek merged 1 commit into
mainfrom
feat/format-announcement-helper

Conversation

@parisek

@parisek parisek commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Helpers::formatAnnouncement(?array $value): array to handle the announcement-bar ACF group, upstreaming logic found byte-identical as a private get_announcement() in four downstream projects (sloneek, mairateam, proficio, proficiohub) plus starter_theme
  • Takes the raw ACF group value (enabled, text, dates.date_from/date_to as date_picker 'U' timestamps = midnight UTC), re-anchors the timestamps to wp_timezone() day bounds (00:00:00 for date_from, 23:59:59 for date_to), and returns millisecond timestamps for Alpine.js
  • Disabled/absent input yields the empty shape; downstream reduces to Helpers::formatAnnouncement($global_fields['announcement'] ?? null)
  • Add 5 new tests covering DST-timezone re-anchoring and ACF string-timestamp inputs (845 total green); PHPStan level 8 clean

Changes

  • src/Helpers.php (modified)
  • tests/Unit/Helpers/FormatAnnouncementTest.php (added)
  • CHANGELOG.md (modified)
  • README.md (modified)

🤖 Generated with PORTA skill for Claude Code

@parisek parisek self-assigned this Jul 4, 2026
@parisek parisek merged commit 759f3da into main Jul 4, 2026
5 checks passed
@parisek parisek deleted the feat/format-announcement-helper branch July 4, 2026 09:33
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.

1 participant