Process Entries of Structure Fields

Hello Bastian

Am I missing something? Are values of entry attributes of structure fields not pre- and post-processed and parsed with the Kirbytext-Processor so one can use (custom) placeholders and Kirbytags there?

Thanks,
Moritz

This depends on how you use them. They are just plain strings and not the more mighty field objects, which you normally get from pages, but you can still wrap the kirbytext() helper around them to parse any kind of kirbytext and custom stuff in it.

Hm, I might be to newbie to get the point. I’m trying to do something like…

title: Page
pages: true
files: true
fields:
  title:
    label: Title
    type:  text
  text:
    label: Text
    type:  textarea
  containerstack:
    label: Container Stack
    type: structure
    entry: >
          (container: {{container}})
    fields:
      container: 
        label: Container
        type: select
        options: query
        query: 
          page: containers

… to customize the output of structure entires in the Panel, but unfortunately, this just leads to something like (container: my-uid). I tried defining my own placeholder as well, and go for something like…

title: Page
pages: true
files: true
fields:
  title:
    label: Title
    type:  text
  text:
    label: Text
    type:  textarea
  containerstack:
    label: Container Stack
    type: structure
    entry: >
          {{my-placeholder}}
    fields:
      container: 
        label: Container
        type: select
        options: query
        query: 
          page: containers

… but that did not help either.

Thanks a lot for helping me —to use the system to break the system. :slight_smile:

The entry option in the panel blueprints is just for displaying the entries within the panel. As far as I know, you cannot use any additional placeholders. A way to solve you problem would be to create your own custom field, e.g. “mystructure” and adapt that to enable use of custom display features.

If you just want to add some text, you can do it like this:

entry: >
      Location: {{location}}<br />
      Date: {{date}} Time: {{time}}<br />
      PLZ: {{plz}} Place {{place}}<br />
      Text: {{text}}<br />
      Link: {{link}}

At least, that seems to work although I’m not sure I got you right.

1 Like

Yep, unfortunately @texnixe is right. I thought you were talking about using the results in your templates.

Thanks @texnix. What methods would I need to overwrite to customize a potential my structure field’s output in the Panel?

The question is what exactly it is that you want to achieve. As I said above, the entry field is only useful for displaying the structure field entries in the panel and have no effect whatsoever of what gets into the text files. So what’s the purpose of the placeholders in the entry field?

Thanks, @texnixe, for your interest; I’m after implementing a field that let’s you build a similar relatedpages field as mentioned in the documentation about $field->pages(). Because coming up with a custom field for building up a list of page values that allows both-reordering its items (and even referencing some URIs twice) isn’t that easy according to @bastianallgeier, I’m using a structure with just one page field in it. Unfortunately editors can only see the URI of each page whereas it would be very helpful if I could expose more detailed information about the referenced pages, e.g. their titles and lead —or even a fully rendered preview.