Snippetfield + Builder united for the best

I’ve been trying to get two amazing fields to work together nicely but have failed so far…
As the name suggests, those plugins are snippetfield and builder

What do I have to do to get this to work?

I understand that I need to alter the builder.php file and include the logic from snippetfield.php for using a snippetfile to display entries but after trying for hours I have just sent my code down the drain as it was horrible (and it hurt my feelings).

Anybody has done this sucessfully before?

I don’t have an answer but a question.

  • Why do you need Snippetfield if you have Builder? What’s missing in Builder?
  • Why do you need Builder if you have Snippetfield? What’s missing in Snippetfield?

Both complement each other!

  • Builder is great for having several structure sets to choose from, and iterating over each in the template with a snippet per set.
  • Snippet field is great for displaying the entries in the panel. I use it very often because it keeps the display logic of entries out of the blueprint which should only manage data logic. I’d love to use that in combination with builder.

It would look like this:

builder:
    label: Sections
    type: builder
    modalsize: large
    fieldsets:
      firstset:
        label: Some Set
        snippet: panel/snippet1
        fields:
          bgcolor:
            label: Section background color
            type: color
          textcolor:
            label: Section Text color
            type: color
    secondset:
        label: Some other set
        snippet: mydir/snippet
        fields:
          bgcolor:
            label: Section background color
            type: color
          textcolor:
            label: Section Text color
            type: color

Does that make sense?

Ps: why does’t code highlighting work well with YAML ? I tred adding YAML, yaml, yml just after the three backticks without any change…

Ahh, I see. :slight_smile: It’s probably easier for @timoetting to implement Snippetfield in Builder than the other way around. The Snippetfield is basically a copy of the structure field with just some enhancements.

1 Like

Thats a great idea. I thought about a way to enhance the preview of the builder sections as well, but didn’t come up with your idea to use snippets. I started to extend the builder field with this feature yesterday and I think, that it will be ready by tomorrow.

4 Likes

Any news @timoetting ? I’m really eager to try this :slight_smile:

I will commit the update today or tomorrow. The update got a bit bigger than initially thought because I also implemented a modalless way to edit the content. You will hear from me.

4 Likes

Oh I’m all ears! Looking forward to testing this!

I just updated the builder field

1 Like