Developing Question

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
roy_k's picture

Hello All,

I need an advice/help.

I want to create a "tournament" with several "categories" within it and each "category" should be managable on its own.

The user should be able to add as many "categories" as s/he needs, when the minimum is 1.

The tournament has a few fields that related to all "categories".
Category has a few fields that apply only to itself.

Any idea? examples?

Thanks

Comments

Depends on how you want to

Chris Graham's picture

Depends on how you want to manage the tournaments.

You could go with a tournament taxonomy where each term is a tournament and add a taxonomy reference field to the category content type to select the tournament.

If you wanted users to create tournaments and categories in one pass you could opt for using Inline Entity Form along with Entity Reference and have the inline creation of categories on a tournament content type.

I was about to suggest

markconroy's picture

I was about to suggest something very similar to what Chris said.

I did something similar recently with an e-commerce store, where there was a "base" product - this was a content type. All products had this as their base, then we used entity referernce to reference products from this. These references were created by using Field Collections. The field collectinons had the product reference fields. Then each product had fields, from Drupal Commerce.

It took a lot of thinking about, but meant that we had one product with the base details (which also allowed us to maintain only one product URL - this was requested for SEO purposes), and we could add the variations of the product such as venue, cost, iventory via inline entity form and field collections.

Content Type vs. Taxonomy Type

bunthorne's picture

In Drupal 7, and with the use of Entity Reference, both Content Types and Taxonomy Types can have fields and can be easily referenced on other forms.

But as an architect, I tend to apply a general rule for the choice between Taxonomy Types and Content Types. I consider Content Types to be something that my end users or editors may need to manage (add entries or update fields), while a Taxonomy I prefer to keep for items that are more static and managed by an administrator or top-level content manager.

That said, I would recommend using a Content Type for both Category and Tournament, if you have users entering both. You can use something like Inline Entity Form (IEF) if you want to embed the entry of Category into the same page as the Tournament.

I also use Field Collection, but I use it for setting multiple instances of a "Performance" (with Date/Time, Venue and Ticket URL fields) within a single Production page that has its own Open/Start and Close/End Dates. (I had previously attempted to just use a separate Content Type for Performance, but Field Collection provided a simpler solution that seemed perfectly suited to the business case.)

Ted Spencer
Addison Spencer Consulting LLC

Ireland

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week