1

I'm very new to Drupal and I would like to know, from a general design standpoint, how you would enter players of a team into drupal. I don't want to add them as users because they should not be able to log in etc.

Each player could have fields like Name, Picture, etc.

Is this really a content type? Because the players are not published alone. Or is it necessary to create a custom module for this?

These players are then used to show the current roster. This could be done with a View and custom template I guess, but I'm not sure. They are also used in game reports (who played in that particular game and maybe the stats)

If I have a database of players somewhere, I would like to have a field that allows me to select a particular player. So basicly I must reference a content type inside another content type. I have not seen that option though.

No technical details are required, just general hints to modules or advice how to accomplish this task.

2

I would say yes, player is a content type in this case. Every player node would represent something (the player) that still has a meaning when you would take it out of its context (the team). Setting it up as a distinct content type will allow for more flexibility in the future, for instance showing player biographies, or transferring a player from one team to another.

If you want to hide the player nodes from regular visitors, you can use the Rabbit Hole module.

To make references between nodes, there are several options. Entity Reference is good and pretty straight forward. It allows you to add a field on the 'team' node type in which you can reference nodes of the 'player' type.

The Relation module is more complex but it can do a lot more. Relation doesn't store the references in the node itself, but it creates a new relation entity for each relation. Those relations can be 1-to-1 or 1-to-many and they can be bi-directional or one-directional. Since relations are entities, you can even add fields to them. For instance, if you define a relation that stores which players play for team X, a field on that relation could store the year/season when that happened. As you can see this offers a lot of possibilities, but it might introduce more complexity than you need.

How you can create the roster depends on the way you build your team-player relations. If you use Entity Reference to create a players field on the tem node, then the roster could simply be a display of the team node. When Drupal displays the team node, Entity Reference can fetch all related player nodes and render them in a view mode of your choice (eg. it can use the teaser view mode of the player node). If you use Relation, you should use the Views module. The Relation module has pretty good Views support (though I haven't used that feature a lot myself) as you can see in this video tutorial.

3
  • Thanks for your detailed answer. The roster should look like this: nba.com/spurs/roster (basically a view listing a players in a specific format) – testalino Jul 25 '14 at 10:47
  • OK, I'll update the answer. – marcvangend Jul 25 '14 at 11:30
  • 1
    Thank you very much. Your answer helped me greatly. I used the Entity Reference module. The roster is now simply a "team" content type that has n player nodes. – testalino Jul 28 '14 at 6:27

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.