Case sensitive tags, turning lowercase

I’m making a multilang website where some parts are from the label of some fields in the panel.
So far, it’s working like that :

fields:
  admin:
    label:
      fr: Équipe administrative
      en: The main team
  <summary><?= $page->blueprint()->field('admin')['label'][$kirby->language()] ?></summary>

I’m trying to get the value of the label using this, it’s working nicely if I use [‘fr’], but as soon as I use [$kirby->language()] it’s returning me this error :

Cannot access offset of type Kirby\Cms\Language on array

Is there something I can do to make this working?
Thanks!

Could you try to use [$kirby->language()->code()]?

Wonderful, worked, thanks
I don’t know why
$kirby->language() did not work, though, because it returned «fr» or «en»…

Thanks a lot :slight_smile:

Glad you solved the issue. Because $kirby->language() returns Language object. $kirby->language()->code() returns a string.

1 Like