$version->update()
Updates the content fields of an existing version
$version->update()
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->update(array $fields, Kirby\Cms\Language|string $language = 'default'): void
Parameters
Name | Type | Default | Description |
---|---|---|---|
$fieldsrequired | array<string, string> |
no default value | Content fields |
$language | Kirby\Cms\Language orstring |
'default'
|
Exceptions
Type | Description |
---|---|
Kirby\Exception\NotFoundException |
If the version does not exist |
Parent class
Examples
$page->version('changes')->update([
'text' => 'Changed text'
]);
// by language
$page->version('changes')->update([
'text' => 'Changed text'
], 'de');
Be careful with this method. It's rather low-level and for more complex fields, you need to use our new Form class and the Form::toStoredValues()
method to provide valid storable data.