Bug in structure entry display field when combined with select in blueprint

Hi,

I think I found a little bug when I use the “entry” field in conjonction with a select field.

example:

  videolist:
    label: Vidéos à insérer
    type: structure
    entry: >
      {{videourl}} / Position : {{position}}
    fields:
      videourl:
        label: "lien de la vidéo sous la forme (vimeo:http://xxx)"
        type: text
      position:
        label: Position par rapport aux images
        type: select
        options:
          beforePics: Avant les images
          afterPics: Après les images

the “entry” field is displayed as “beforePics” (the key as a string) in panel, instead of “Avant les images” (the value).

{{videourl}} is displayed nicely

How can I display the value in panel ? Because user are confused by the raw key.

When style: table is used, the key is also displayed as is in table.

thanks.

It’s not so much a bug but normal behavior of the select field, because the “value” (“Avant les images” in this case is in fact just a label that is shown to the user, while “beforePics” etc. is the value that is stored in your text file with the key “position”.

ok thank you for the explanation. Is there any way to display the label in panel ?

I don’t think so, but you can change the value:

position:
  label: Position par rapport aux images
    type: select
    options:
      Avant les images: Avant les images
      Après les images: Après les images

However, that would probably not make sense, because I guess you want to use the value for styling purposes …:frowning:

Ok, but i use it in php function after this, so it’s not really php friendly. thanks.

If you name the options like above, you could do a mapping in config and then use the values from there in your script.

Not sure to understand, I will stick with the “beforepics” for now, don’t want to over-complicate the code. Thanks for rour help.

Anyway, here’s a how to:

In your config.php

c::set(array(
  'Avant les images' => 'beforePics',
  'Après les images' => 'afterPics'
));

In your template/script:

<?php echo c::get('Avant les images') ?>
//or with variable from your example
<?php foreach($page->videolist()->toStructure() as $item) {
  echo c::get($item->position()); 
} 
?>