File Access
Files can be gated with the same gates field as pages. Use this page when you want to protect downloads or media.
File blueprint
site/blueprints/files/default.yml
title: Default Files Blueprint
fields:
gates:
extends: fields/klub/gates/plans
Filtering file collections
<?php foreach ($page->images()->removeNotAllowed() as $image): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endforeach ?>
Checking a single file
<?php if ($file->isAllowed()): ?>
<a href="<?= $file->url() ?>">Download</a>
<?php endif ?>