Skip to content

Kirby 3.9.8

$site->update()

Updates the model data

$site->update(?array $input = null, ?string $languageCode = null, bool $validate = false): Kirby\Cms\Site

Parameters

Name Type Default
$input array|null null
$languageCode string|null null
$validate bool false

Return type

Kirby\Cms\Site

This method does not modify the existing $site 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\Site inherited from Kirby\Cms\ModelWithContent

Example

try {

  $site->update([
    'title'       => 'My Site',
    'description' => 'it is really nice',
  ]);

  echo 'The site info has been updated';

} catch(Exception $e) {

  echo $e->getMessage();

}