1

I’m trying to figure out a way to setup a simple Craft section: a list of projects, each project consisting of a title and a type; and a series of photos, each photo having a description.

BUT... If I do this as a structure, the client is then able to nest them in a nonsensical hierarchy, like adding projects as children of photos. I know that's going to confuse my client. A way to lock down entries to a specific level would be sufficient, but I'm not finding that...

2

Honestly, the answer to your question is to not use structures to solve this problem. Here's a rule of thumb on structures: don't mix content types in the same structure ("content type" being a generic term for specific pieces of your content; e.g. blog posts, projects, testimonials, slides, pages, etc). So, for example, in your case a structure shouldn't contain projects and slides. However, if you had maybe projects and sub-projects, that could work well as a structure.

There are at least two options that I think are a better way to solve this. I personally would prefer #2 but figured I'd give you both of the ones I thought of off the top of my head.

  1. Create a channel of slides, and then from your project entries in your structure use an entries field to select the slides that should belong to that project entry. However, this could and probably would become an editing nightmare because all the slides of all the projects will be all in the same channel and depending on your editing workflow it could be a pain to try to edit one particular slide.

  2. Utilize a Table, SuperTable, Matrix, or Neo field to create the slides inline in the project entries. All of these field types have the concept of repeating rows or blocks that you could use to create something like a collection of slides. A pro tip: if you want to keep the slides "separate" from your project content, you could always create a new tab in the field layout for your "slider builder".

Hopefully that helps... If you need me to clarify anything I said feel free to comment below and I can update this answer accordingly!


Update:

Here are some screenshots explaining what I was referring to in #2:

  • This helps a lot. However, Table, SuperTable, and Neo field are not things I've been exposed to so far, as they are not covered in the CraftQuest tutorial. I will look into those, but do you have a feeling about which of the options you provided would be the most straightforward way for me to build out, and for my client to understand? – BBaysinger Aug 26 '19 at 18:54
  • 1
    Definitely #2. It looks like Table fields can't contain asset (image) fields, so that's actually off the table (pun fully intended haha). SuperTable and Neo are both third-party field types so I'd probably recommend setting up a Matrix for now; I think that will cover your needs nicely. You'll need to create a matrix field, then create a block, and then create an asset field and a text field in that block. Then you'll be able to add new slides as needed from the entry edit screen. Let me take a couple screenshots and update my answer for ya... – Jalen Davenport Aug 26 '19 at 19:04
  • Very helpful so far. One thing though. I'd like a place to specify a type for each project. Is that in here somewhere, and I'm just missing it? – BBaysinger Aug 26 '19 at 20:52
  • 1
    Yep, that's correct; the matrix field is added to the project entries. And then you'd control the project titles/types/etc via the other fields added to your project entries. The matrix would only be handling the photos... – Jalen Davenport Aug 27 '19 at 1:34
  • 1
    Also, not sure if you're a part of the Craft CMS community on Discord (craftcms.com/discord), but feel free to @ me over there and we can continue the discussion as Stack Exchange isn't really suited for a longer conversation or additional questions. – Jalen Davenport Aug 27 '19 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.