Skip to content

Kirby 4.5.0

$files->add()

Adds a single file or an entire second collection to the current collection

$files->add(\Kirby\Cms\Files|\Kirby\Cms\File|string $object): Kirby\Cms\Files

Parameters

Name Type Default
$object * Kirby\Cms\Files|Kirby\Cms\File|string

Return type

Kirby\Cms\Files

This method does not modify the existing $files object but returns a new object with the changes applied. Learn more →

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException When no File or Files object or an ID of an existing file is passed

Parent class

Kirby\Cms\Files