Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for using collection_item in a sample/preview #100

Open
julianrubisch opened this issue Dec 16, 2024 · 1 comment
Open

Example for using collection_item in a sample/preview #100

julianrubisch opened this issue Dec 16, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@julianrubisch
Copy link

Sorry for posting this here in the issue tracker, but I haven't found a link to a discussion board or similar...

I'm setting up a "news preview" in my app using collection_item in my app and it works like a charm 🪄

BUT: I can't figure out how to show them in an admin preview using the sample block. Here's what I've got:

name: "three columns with images"

category: blog

settings:
- label: "Title"
  id: title
  type: text
  default: Headline
- label: "Overview link"
  id: overview_link
  type: link
  with_text: true
  default: { text: "Link", href: "#" }

blocks:
- name: "Item"
  type: item
  limit: 3
  settings:
  - label: "News Item"
    id: news_item
    type: collection_item
    collection_id: news_items

blocks_label: "Top 3 News Items"

sample:
  settings:
    title: Aktuelle News
    overview_link: { text: "Link", href: "#" }
  blocks:
  - type: item
    settings: ???

This is probably hard to generalize, if it works at all, but one could potentially link to a test fixture or something?

@did did added documentation Improvements or additions to documentation question Further information is requested labels Dec 16, 2024
@did
Copy link
Contributor

did commented Dec 16, 2024

👋 @julianrubisch, the documentation is incomplete indeed and I've to update it.

In the meantime, you could use any as the id of the collection item. Something like this?

sample:
  settings:
    title: Aktuelle News
    overview_link: { text: "Link", href: "#" }
  blocks:
  - type: item
    settings:
       news_item: 
           id: any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants