diff --git a/app/Nova/TrainingResource.php b/app/Nova/TrainingResource.php index 62809ffb9..0be886d64 100644 --- a/app/Nova/TrainingResource.php +++ b/app/Nova/TrainingResource.php @@ -70,7 +70,7 @@ public function fields(Request $request): array ) ->nullable() ->hideFromIndex() - ->help('Leave empty to keep the default English PDF links. Use the toolbar to add links (select text → link), lists, and headings. Include [[key_one_pagers_locale_note]] if you want the translated intro sentence.') + ->help('Leave empty to keep the default English PDF links. Use the toolbar to add links (select text → link), lists, and headings. For Discover Digital, the Key one-pagers intro sentence is added automatically in the visitor’s language.') ->resolveUsing(function () use ($locale) { $overrides = $this->resource->locale_overrides ?? []; diff --git a/app/TrainingResource.php b/app/TrainingResource.php index a4a117a3c..8b8c8dd98 100644 --- a/app/TrainingResource.php +++ b/app/TrainingResource.php @@ -216,4 +216,44 @@ public function hasPdfLinksOverrideForLocale(?string $locale = null): bool return is_array($replacements) && $replacements !== []; } + + /** + * PDF links HTML with the locale-aware Key one-pagers note applied. + */ + public function renderedPdfLinksSectionForLocale(?string $locale = null): string + { + $section = $this->pdfLinksSectionForLocale($locale); + if ($section === '') { + return ''; + } + + $noteHtml = ''.e(__('training.discover_digital_key_one_pagers_note')).''; + + if (str_contains($section, '[[key_one_pagers_locale_note]]')) { + return str_replace('[[key_one_pagers_locale_note]]', $noteHtml, $section); + } + + // Discover Digital: inject the note even when locale overrides omit the placeholder. + if ($this->slug !== 'discover-digital-programme') { + return $section; + } + + $headingPatterns = [ + '/(