Add ACF investment report field for pension fund pages#69
Open
taavipertman-glitch wants to merge 3 commits into
Open
Add ACF investment report field for pension fund pages#69taavipertman-glitch wants to merge 3 commits into
taavipertman-glitch wants to merge 3 commits into
Conversation
Add investment_report_file ACF field to the stocks, bonds, and third pillar fund page templates, matching the pattern TKF100 already uses. When the ACF field is set (via wp-admin or REST API), it overrides the hardcoded report URL. When not set, the current hardcoded URL remains as fallback — safe to deploy without setting the fields first. This enables: - Manual report updates from wp-admin (same as TKF100 today) - Automated updates via WordPress REST API from onboarding-service Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add esc_url() and esc_html() to prevent potential XSS via ACF-managed URLs. Guard preg_match before accessing $matches to avoid PHP notices when URL has no /YYYY/MM/ date segment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
generate_report_link() previously discarded the URL host and rebuilt the link against get_site_url(), which breaks ACF-supplied media URLs served from a CDN or dedicated media host. Absolute URLs now pass through with their host intact; only site-relative paths are resolved against the site. The date label was derived from the WordPress upload-folder month minus one, which is wrong when a report is uploaded in a different month than the period it covers. The investment report pipeline encodes the period directly in the filename as YYYY-MM, so parse that when present and fall back to the legacy folder-month heuristic only for the old hardcoded report URLs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
investment_report_fileACF field to TUK75, TUK00, TUV100 fund pages (matching TKF100's existing pattern)Safe to deploy immediately — no behavior change until someone sets the ACF field on a fund page.
What this enables
Changes
helpers/acf/fund-pension.php— new ACF field group withinvestment_report_filefor page templatespage_fund-stocks.php,page_fund-bonds.php,page_fund-third.phphelpers/acf/init.php— include the new filefund-stocks-details.php— useget_field('investment_report_file')with hardcoded fallbackfund-bonds-details.php— samefund-third-details.php— sameAfter merging
Once the ACF fields are set on each fund page (either manually or via REST API), the hardcoded fallback URLs can be removed in a follow-up cleanup.
🤖 Generated with Claude Code