Helper tool that enables ray on all extendable methods.
Ray is the fantastic dump debugger from our friends at Spatie. You can find more information about Ray on https://myray.app/.
By default the ray helper won’t be enabled, you can enable it by setting debug
to true
or by adding the enabled
option in the config file.
# site/config/config.php
return [
'debug' => true,
// OR //
'genxbe.ray.enabled' => true,
];
Add ->ray()
after the page, field, or other object you want to parse in ray. This helper doesn’t interrupt your flow so whatever you are doing will still work if you add the helper.
Pass a color as parameter if you want to enable color filtering in ray.
<?php
// Parse page in ray
$myField = $page->ray()->myField();
// Parse page in ray with the blue color filter active
$myTitle = $page->ray('blue')->myTitle();
// Parse the page and the field in ray
$projects = $page->ray()->projects()->ray();
?>
<?= $site->seoOgImage()->ray() ?>
<?= $site->footerLinks()->toStructure()->ray() ?>
<?= $site->footerLinks()->ray('red')->toStructure()->ray('blue') ?>
Download and copy this repository to /site/plugins/kirby3-ray
.
git submodule add https://github.com/genxbe/kirby3-ray.git site/plugins/kirby3-ray
composer require genxbe/kirby3-ray
MIT