From aa125c00e7092f5bbffbc3a02d2b18d38436eaaa Mon Sep 17 00:00:00 2001 From: ADmad Date: Sat, 28 Feb 2026 11:28:07 +0530 Subject: [PATCH 1/2] Improve the custom view example --- docs/en/views.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/en/views.md b/docs/en/views.md index a0e49783f2..1b540e1ad3 100644 --- a/docs/en/views.md +++ b/docs/en/views.md @@ -756,6 +756,15 @@ use Cake\View\View; class PdfView extends View { + protected $layoutPath = 'pdf'; + + protected $subDir = 'pdf'; + + public static function contentType(): string + { + return 'application/pdf'; + } + public function render(?string $view = null, ?string $layout = null): string { // Custom logic here. From 3ec903892b8db28b3eea2e8a65456c0132ceaeac Mon Sep 17 00:00:00 2001 From: ADmad Date: Sat, 28 Feb 2026 11:29:46 +0530 Subject: [PATCH 2/2] Add types for properties --- docs/en/views.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/views.md b/docs/en/views.md index 1b540e1ad3..7b82ce69a2 100644 --- a/docs/en/views.md +++ b/docs/en/views.md @@ -756,9 +756,9 @@ use Cake\View\View; class PdfView extends View { - protected $layoutPath = 'pdf'; + protected string $layoutPath = 'pdf'; - protected $subDir = 'pdf'; + protected string $subDir = 'pdf'; public static function contentType(): string {