$file->update()
Updates the model data
Parameters
Name | Type | Default |
---|---|---|
$input | array |null |
null |
$languageCode | string |null |
null |
$validate | bool |
false |
Return type
This method does not modify the existing $file
object but returns a new object with the changes applied. Learn more →
Exceptions
Type | Description |
---|---|
Kirby\Exception\InvalidArgumentException |
If the input array contains invalid values |
Parent class
Kirby\Cms\File
inherited from Kirby\Cms\ModelWithContent
Example
Kirby's objects are immutable. That means, when you modify an object like $page
, $file
etc. using a method like update()
, changeTitle()
and so on, a new object is returned. Therefore, you have to store the returned object in a new variable to be able to further work with it.
Multi-language installation
In a multi-language installation, you can pass the language of the meta data you want to update as a second argument: