5

Not sure how to phrase this question but basically I'm creating an non-profit's internal portal within Drupal.

They deal with school sponsorship of children and we want to manage this database in Drupal. Within administration the staff should be able to add/edit/delete a Child from sponsorship much in the same way you would deal with a content node.

I don't want to add Content Type 'Child' as it's not directly for the front-facing website. But would prefer to create a "new node type" (does this make sense?)....in the same way that the Commerce module allows for addition of Products, separate from content.

How would I go about this? (I think I'm missing a key technical word for "Node type"...)

8

I think the technical term you're looking for is 'entity type'. A node is an 'entity' in Drupal, as is a User, Taxonomy Term, Commerce Product etc.

The simplest way to create a new entity type is with the Entity Construction Kit:

The Entity Construction Kit builds upon the entity system to create a flexible and extensible data modeling system both with a UI for site builders, and with useful abstractions (classes, plugins, etc) to help developers use entities with ease.

But you can of course do it manually too. The Examples module contains a fully working module that defines a custom entity type, if you wanted to code your own solution that would be the best place to start.

6
  • 3
    Another option would just be to use nodes, and set up some form of content access or Rabbit hole
    – Chapabu
    Jan 29 '13 at 13:50
  • 2
    Yeah Rabbit Hole is a good option I use it quite a lot myself. Creating an entity type is at least a reasonable amount of work so if you can get away with using a node and bending it to what you need, it'll get you there quicker. Having said that, writing your own entity type will give you an invaluable insight into the whole world of entities/fields from a code point of view
    – Clive
    Jan 29 '13 at 13:52
  • Example modules are a great asset, they are going to be really helpful. Thanks! Jan 29 '13 at 14:01
  • 3
    @Chapabu content access on a node type is great, but a custom entity ensures you don't have to counter-act unexpected things like: paths (node/123/view|edit|delete|print), RSS feeds, search results, hard-coded inclusion in taxonomy term pages (should you use a term reference field), and other unknowns. These days I prefer custom entities when I know the content is more programmatic in behavior and less public-facing. My 2 cents. Jan 29 '13 at 17:25
  • 1
    @CharlieS it's always good to get other opinions, that's what makes a good community a great community :-) I'd probably go down a custom entity route too (and once you've done a couple its pretty quick to hammer them out), but its always good to give options :-)
    – Chapabu
    Jan 29 '13 at 22:23
0

I'm not sure why you don't want to use a node.

When you want a node to refer to another node, use Entityreference or maybe Relation.

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.