I'm new to drupal, and am unsure how to aproach writing a module. My uni is moving to drupal, and I'm working on getting a courses module to display information about courses at the uni.

List of things I need to implement

  • A list of courses in a specific subject that can be put in many places on the site, with differnt subjects
  • Search page
    • I think I understand how to do this one, at least
  • List of courses based on search parameters
  • List sections in a specifc course and term

I've figured out how to make custom pages and pass data around in the url by follwoing the drupal menu example. From here, I could just custom write everything, and return straight html, and it seems like that would work, but not be the "correct" way to do it in drupal.

The data will be available in an API of sort, I don't know much about it yet. NOrmally I would just make a data class that had sample data in it, and deal with the data later, but it seems like this won't work in drupal.

Should I be aproaching this by trying to get the views module to do the views for my module? It seems like this would be the correct way to do it, but the query is stupidly complex SQL, and the output can't just be a list.

Also, where is a good tutorial on how I should be using content types? It seems like I should be using that effectively as a data class, that somehow gets passed to a view(possibly the views module, maybe just a view I write myself for a page), which renders it, but I haven't been able to figure it out.

Sorry that there is no concrete answer for this, I just really need pointers on how to aprocah drupal modules.

closed as primarily opinion-based by kiamlaluno Jun 6 '14 at 4:51

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Much of what you want to do there can be done with core and popular contrib modules. If you do want to learn more about module development, online docs here:drupal.org/developing/modules – David Thomas Jun 6 '14 at 2:20
  • Welcome to Drupal Answers! This question is too broad and subjective. We cannot suggest how to write a module, and if it is better to use a module or the Views module, without more restrictive requirements. Also, requests for tutorials are off-topic, here. – kiamlaluno Jun 6 '14 at 4:55

Content Types and /or entities would be the way to go about this. Content types you can think of as objects that are fieldable. So for example your course would have fields that would represent an objects property. All content types are node and accessed similarly and can be distinguished by a node id (nid). Content types automatically integrate into views.

Views can be used to display your data on the courses and they can be filtered by using exposed filters, or filtered by using contextual filters (arguments from the URL). Content types are automatically usable in views along with their fields

Entity references are the backbone of relationships in drupal. In an object sense you can have a one to one, one to many relationships with other objects or content types. So your course may have sections and what not so in drupal you would create a content type of both Course and Section and then reference them using the entity references module. See entity reference module which must have the entity api module

Taxonomy is a way to tag stuff so if you want to tag a course a certain subject you could use a field that is a taxonomy reference.

  • So this would require all of the course data to be in drupal, yes? – mtfurlan Jun 6 '14 at 6:20
  • As much of it as you can. What did you have in mind? – chadpeppers Jun 9 '14 at 21:51
  • There is a stupid amount of data, and we aren't the ones that control it. We had wanted to just use the data straight from the database it's currently in. It's looking like this means that we need to do everything custom, yes? – mtfurlan Jun 10 '14 at 9:21
  • Probably in that case, or use the migrate module to migrate the data at certain times. – chadpeppers Jun 10 '14 at 21:34

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