bnomei/kirby3-boost

View on GitHub
collections/example_filter_boostidkvs.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

// this example uses lapse plugin to build a static cache (makes panel faster) and filter the base kv collection by template.
// performance is mediocre at best since each object will be resolved.

return fn () => lapseStatic(__FILE__, function () {
    return collection('boostidkvs')->filterBy(
        function ($kvObject) {
            if ($kvObject->template === 'post') {
                return boost($kvObject->value);
            }

            return null;
        }
    );
});