How to make a list of case studies with a thumbnail image?

Yes thats right. You could have done

<?php foreach($caseStudies as $choclatecake): ?>

but then inside you would need

<?= $choclatecake->title()->html() ?>

So yes you can call it what you like :slight_smile: just make it something meaningful to what the code is doing.

1 Like

The number of files you can select can be limited with the max property.

cover:
  type: files
  max: 1
1 Like

On a side note: each field with available properties and how to use in template is decribed in the reference:

e.g files field:

props: Files | Kirby CMS
use in template: Files | Kirby CMS

These doc sections are available in (almost) every field description, apart from those that don’t need any specific output or have no output (gap, headline, info).

Thanks. I had looked at those pages, but I’m not sure it says anything about how to set a ‘hero’ or ‘key’ or ‘cover’ image for a page in the Panel? I’m assuming a ‘cover’ image is one image to be used as the ‘main’ key image for a page? Or have I misunderstood what a cover is?

What you name your fields is completely up to you (within the already mentioned limitations on field names). The important thing is the field type you choose, and to select an image, the files field is the right choice.

So the questions would be: I want a field where I can select an image. Let’s see what field types there are in Kirby that fit my use case.

Ideally, the documentation would be written from a use case perspective, and we do that in our recipes. But that would never work for simple use cases like selecting the right field for a purpose.

Okay… so the word ‘cover’ could actually be anything – ‘moon_base’ – for example. So the word ‘cover’ is just the name/label that appears in the Panel above the field type. In that case I’m going to rename it ‘Key image’… just tried that and I get an error message saying “The field “key%20image” could not be found”.

Okay I remember, you can only use

alphanumeric characters and underscores in field names

Is there a way to get this label / name to be able to display more than one word in the Panel, without using underscores? For example ‘Key image’ or ‘Main text column’ etc to help clients to understand what is going on?

EDIT

Okay I can use a label to get more than one word to display in the Panel

subheading:
  label: Sub heading
  type: text

Don’t understand that. Does the first name relate to and link with the field names used in my content .txt files? But it doesn’t seem to match. In the Panel I have description_meta_tag but in my .txt file it is written Description-meta-tag

Yes, the Panel transforms underscores to dashes when saving (can’t remember why). The important thing to keep in mind is that dashes and spaces are not allowed in blueprint keys.

1 Like

Okay thanks.