Kirby appreciation post (And a select snippet)

Very long time and no post – but I need to give a shoutout how this framework (still) kicks some serious ass :star_struck:

So… I haven’t been working properly with Kirby in months or even years. But today I wanted to create an intelligent snippet for select fields. And just some simple thought like “Well, if I’d do this then this should do that…” led to a great result. Without browsing through the forum etc. Damn, I love how easy this framework language works :heart:

What I wanted to do was making it super flexible to create a select field via a snippet’s array. And it “just” worked :wink:

<?php snippet('forms/fields/select', ['label' => 'Kursauswahl', 'size' => 0, 'options' => 'Kann; man; machen; muß aber nicht']) ?>
<div class="field">
    <label for="<?= Str::slug($label) ?>"><?= $label ?></label>
    <select id="<?= Str::slug($label) ?>" name="<?= Str::slug($label) ?>" size="<?= $size ?>">

        <?php $option = Str::split($options, ';'); foreach ($option as $o): ?>
            <option value="<?= Str::slug($o) ?>"><?= $o ?></option>
        <?php endforeach ?>


No big news at all, nothing special – but just a super satisfying experience for someone who doesn’t work as often with Kirby as he would like to :heart:


Awwwww, this already made my day :slight_smile:


That was my intention, sir :cowboy_hat_face:


P.S.: I especially needeed to say this because I need to work with TYPO3 most of the time and doing such a thing there would have been less easy simple. To say the least :roll_eyes: