Panel field 'label', can't get it to work

Hi!

I have a blueprint, but the labels don’t seem to work.

I’ve posted the code and a screenshot of the resulting panel form below.

<?php if(!defined('KIRBY')) exit ?>

title: Blog post
pages: false
files: true

fields:
  titlearabic: 
    label:Arabictitle
    type:textarea
    placeholder:Blog post title
  titleenglish: 
    label:Englishtitle
    type:textarea
    placeholder:Blog post title
  date:
    label:Date
    type:text
    placeholder:dd/mm/yyyy
  textarabic: 
    label:  Arabic
    type:   Markdown
    tools:
            - bold
            - italic
            - header2
    header2: h6
  textenglish: 
    label:  English
    type:   Markdown
    tools:
            - bold
            - italic
            - header2
    header2: h6

The issue is that the YAML syntax requires a space between the name and value, meaning: Instead of “label:Arabictitle” it needs to be “label: Arabictitle”. The same applies for all other lines.

BTW: Did you know that Kirby supports multiple languages for the same site? That way you don’t need to put the fields into the same Panel page, but one per language.


I have changed your syntax. Code blocks use three backticks at the start and end (on separate lines), just like on GitHub. :slightly_smiling:

Hi Lukas!

Firstly, thanks for such a speedy response, and on a weekend :smiley:

That solved the problem, a simple space, ha ha!

I fiddled about with the language support, but couldn’t get it to work the way I wanted. Probably partly because I didn’t want to have two different pages with a language each, as I am coding the website with the two language side by side on every page, as opposed to different language versions of each page. Dunno if I’m making sense?

And thanks for teaching me how to post the code!

Yes, then what you are doing is completely correct. The multi-language feature only works with one language at any given time.

You are welcome. :wink:

I don’t know if this is in line with pure doctrine, but maybe less messy in the panel, but you could in fact achieve what you want to do in a multi-language installation.

In your templates, instead of calling only the standard methods, e.g.

<?php
echo $page->title();
?>

You could do this:

<?php
echo $page->content('en')->title();
echo $page->content('ar')->title();
?>

Then your blueprints and your forms would be only half as long … a bit more coding, though.

Any opinions?

But that would still result in language-specific URLs, so the same page woule exist in both languages in the frontend.

Yes, but you could use a route to redirect one to the other.

But you would still have the language code in the URL. Your solution definitely works, but I think it is a bit hacky. :slight_smile:

Not for the main language.

That’s what I was asking myself, but in this case, I would still go down this route to make editing content more convenient.