Skip to content

Commit d094139

Browse files
authored
update docs
1 parent 039879e commit d094139

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/fe-content.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ $blogPosts = inspirecms_content()->getByDocumentType(documentType: 'blog_post',
3737
$blogPosts = inspirecms_content()->getPaginatedByDocumentType(documentType: 'blog_post', isPublished: true, page: 1, perPage: 10);
3838
```
3939

40+
> [!note]
41+
>
42+
> These functions return Content model instances. To access content properties and use them in templates, convert the model to a DTO using the `toDto()` method:
43+
>
44+
> ```php
45+
> $contentDto = $content->toDto($locale ?? app()->getLocale());
46+
> $title = $contentDto->getTitle();
47+
> ```
48+
4049
---
4150
4251
## Accessing Content Properties
@@ -209,4 +218,4 @@ $paginatedContent = inspirecms_content()->getPaginatedByDocumentType(documentTyp
209218

210219
> [!note]
211220
>
212-
> For examples of displaying content in layouts, see the [Layouts](./fe-layouts){.doc-link} documentation.
221+
> For examples of displaying content in layouts, see the [Layouts](./fe-layouts){.doc-link} documentation.

0 commit comments

Comments
 (0)