Skip to content

Kirby 5.2.3

$version->content()

Returns a Content object for the given language

$version->content() has been marked as unstable. It might be changed in a future Kirby major or minor release without being considered a breaking change. Use with caution.

$version->content(Kirby\Cms\Language|string $language = 'default'): Kirby\Content\Content

Parameters

Name Type Default
$language Kirby\Cms\Languageorstring 'default'

Return type

Kirby\Content\Content

This method modifies the existing $version object it is applied to and returns it again.

Parent class

Kirby\Content\Version

Examples

$page->version('latest')->content();
$page->version('changes')->content();

// getting content in a particular language
$page->version('changes')->content('de');
$page->version('changes')->content('current');
$page->version('changes')->content('default');

This will return regular Kirby\Content\Content objects that help to access fields. So for example, if you want to receive the latest or changed text of a page, you can do this:

$page->version('latest')->content()->get('text');
$page->version('changes')->content()->get('text');