This adds the class false or true to my images. And I have a css style for .true to add a border. Is there a way to rename false and true to something more meaningful? For example adding the classes no-border or border?
You currently just echo border field value, which is either true or false. What you need instead is check the border field value and echo something based on that value.
if($image->border()->toBool() === true) {
// the toggle is "on", meaning you want to add border class (the class name can be anything, I chose border)
echo "border";
}
and you get the same result. With e() helper it is much shorter.