Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Blueprint Import Jumping Sections

Started by Mary Warrington 8 years ago · 1 replies · 662 views
8 years ago

I have a blueprint situation I can't quiet figure out: I have a fields/media-tile.yaml, which includes an optional fields/buttons.yaml to render a button in the tile. This works just fine. The issue comes when I import the media tile into a grid, in modular/media-tile-grid.yaml: Where most of the props stay with their appropriate tile (title, text color, background image, etc.), the button jumps out of it's own media tile array, making it appear on all media tiles in the grid. Long story short: if I want to add a button to one tile in the grid, it will appear in all of them. I can manually fix this by moving the button in the final markdown file, but that's easily broken by content editors (and a pain!).

What am I doing wrong in my blueprint? Simplified version pasted below, with .tile_buttons being the issue.

YAML

form:
  fields:
    header.media_tiles:
      name: media_tiles
      type: list
      style: vertical
      label: Media Tiles
      fields:
        .title:
          type: text
          label: Title
        .body:
          type: editor
          label: Main Copy
        .media:
          type: file
          multiple: false
          label: Background Image
          destination: '@self'
          accept:
            - image/*
        .bg_color:
          type: select
          label: Background Color (if no image)
          options:
              0: None
              blue: Blue
              green: Green
        .tile_buttons:
          type: section
          import@:
            type: fields/buttons
            context: blueprints://
8 years ago

Here's what the output looks like — this image shows the second of 3 tiles in a grid. I saved the button in the second tile, but you can see it here displaying a level up (outside of the tiles entirely), and therefore displaying on all three tiles.

55%20AM|551x500

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1140 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago