Reference

Guide

$files->intersection()

Returns a Collection with the intersection of the given elements

$files->intersection(\Kirby\Toolkit\Collection $other): Kirby\Toolkit\Collection

Parameters

Name Type Default Description
$other Kirby\Toolkit\Collection

Return type

Kirby\Toolkit\Collection

Example

$images1 = $page->files()->template('cover');
$images2 = $site->files()->template('cover');

$intersection = $images1->intersection($images2);
dump($intersection);

Inherited from

Kirby\Toolkit\Collection

Source code

kirby/src/Toolkit/Collection.php#L551