Domanda

I'm trying to develop my first module in Orchard and stuck with the following problem.

I have Box content type that contain Books. What I want to achieve is to allow user to add books from box edit screen in admin. The process is the following:

  1. User selects a Box in admin and click edit.
  2. In edit screen a list of books is displayed with buttons "Edit", "Delete" and "Add Book"
  3. The user clicks "Add Book" button and add book screen appears.
  4. The user enters required metadata and clicks "Save"
  5. The user is redirected back to Box edit screen with new book added to the list.

I'm looking for advise on what is the best way to implement this.

È stato utile?

Soluzione

There are several ways to do that, most of which don't require building a module.

You could use the updated list feature in the new Orchard 1.8. That does pretty much exactly what you describe.

You could use taxonomies, where the boxes are terms (terms have their own content type that you can extend). The workflow is kinda backwards with this, where you put books in boxes rather than picking from the box which books belong.

You could use a content picker field configured for multiple items, and constrained to the book content type.

You could build your own module, with a relationship between your types, as explained here: http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations but except if this is a pure learning experience, there's little reason to go for that one, as the other three above are so much simpler, and don't require any coding.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top