User login

Custom nodes module AND CCK: Bdragon serves you cake and lets you have it, too

stompeers___: I have just a few tables: masters (which are the CDs and DVDs), sales orders (which consist of orders from clients) and work orders (each work order is for a single master, and there may be many work orders for a single sales order).
[9:26pm] pnm_ joined the chat room.
[9:26pm] designerbrent left the chat room. (Read error: 110 (Connection timed out))
[9:26pm] purserj joined the chat room.
[9:26pm] calebg: Bdragon|vocalo: It's not me. It's the hunchbaque theme. I just saw their commit message. http://drupal.org/cvs?commit=89465
[9:27pm] Bdragon|vocalo: And you want to use upload.module?
[9:27pm] aclight joined the chat room.
[9:27pm] stompeers___: I suppose I could put all of those into nodes, but it feels funny and I'm not sure why.
[9:27pm] stompeers___: Yeah, because each 'master' has a PDF associated with it.
[9:27pm] stompeers___: For the cover art.
[9:27pm] Bdragon|vocalo: OK
[9:27pm] Bdragon|vocalo: How are masters associated with the rest?
[9:28pm] Bdragon|vocalo: They are the base that everything else is about, right?
[9:28pm] Bdragon|vocalo: If masters were nodes, and sales orders and work orders were custom...
[9:28pm] stompeers___: There may be many work orders for each master. There may be many work orders for each sales order.
[9:28pm] designerbrent joined the chat room.
[9:28pm] pnm_ left the chat room. (Client Quit)
[9:29pm] pnm_ joined the chat room.
[9:29pm] stevek left the chat room. (Remote closed the connection)
[9:29pm] stompeers___: That's kind of what I was thinking. But then, if orders were nodes, I could add in additional CCK fields later on, which might be nice...
[9:29pm] Bdragon|vocalo: Yeah
[9:30pm] webchick left the chat room.
[9:30pm] Bdragon|vocalo: What's the expected volume of each thing?
[9:30pm] stompeers___: You can exclude certain node types from a site-wide search right?
[9:31pm] stompeers___: Say about 2000 masters, and a growing number of orders, probably 10 a week. Double that for work orders.
[9:31pm] aboo left the chat room. (Connection timed out)
[9:31pm] Bdragon|vocalo: Yeah, you can exclude certain node types from a site wide search...
[9:31pm] Bdragon|vocalo: I can't remember the specifics off hand though
[9:33pm] Bdragon|vocalo: 111744
[9:33pm] Druplicon: http://drupal.org/node/111744 => Exclude node types from search index => Drupal, search.module, normal, patch (code needs review), 4 IRC mentions
[9:33pm] Bdragon|vocalo: #33 is an idea...
[9:33pm] stompeers___: Also, by being a CCK type, there will be all these additional options that I'm not too concerned with, like 'published', 'menu' and 'URL path settings'.
[9:33pm] Bdragon|vocalo: Using hook_view checks..
[9:34pm] jhedstrom left the chat room. (Remote closed the connection)
[9:34pm] Bdragon|vocalo: Well, any node type is like that
[9:35pm] Bdragon|vocalo: You might want to A) make "traditional" node types in code so you have full control over the access hooks, and hook_form_alter out most of the addon stuff like path and menu.
[9:35pm] Bdragon|vocalo: CCK can attach to any node type, by the way
[9:36pm] Bdragon|vocalo: hmm, interesting... http://drupal.org/project/search_config
[9:36pm] stompeers___: Can you offer a little more explaination on "make "traditional" node types in code so you have full control over the access hooks"? You would still have options to edit the form via the FAPI with a custom module, right?
[9:38pm] kentbye left the chat room.
[9:38pm] Bdragon|vocalo: Well, it looks like the problem of excluding content types has been solved, so I guess it's not necessary after all
[9:38pm] snufkin left the chat room. ("Leaving")
[9:39pm] stompeers___: Thank you for checking into that
[9:39pm] pnm_ left the chat room. (Read error: 104 (Connection reset by peer))
[9:39pm] Bdragon|vocalo: Content types have a certain module with "special" privilege when it comes to node objects
[9:39pm] Bdragon|vocalo: Sort of an "owner"
[9:39pm] pnm_ joined the chat room.
[9:39pm] Bdragon|vocalo: Content types created by the user are owned by node.module. A module is allowed to define its own content types.
[9:40pm] Bdragon|vocalo: Any nodes of this type created are owned by that module, giving it a bit of additional control over things.
[9:40pm] stompeers___: What is an example of something you could do with a node that is defined in a module vs. in CCK?
[9:41pm] Bdragon|vocalo: hook_access:5?
[9:41pm] Druplicon: hook_access: Define access restrictions. => hook_access($op, $node) => http://api.drupal.org/api/function/hook_access/5
[9:41pm] Bdragon|vocalo: hook_view:5?
[9:41pm] Druplicon: hook_view: Display a node. => hook_view($node, $teaser = FALSE, $page = FALSE) => http://api.drupal.org/api/function/hook_view/5
[9:41pm] Bdragon|vocalo: This stuff mainly..
[9:42pm] Bdragon|vocalo: As well as having control over the "base" form and being able to load additional fields first
[9:42pm] stompeers___: Huh, thanks for showing me that. I wouldn't have even thought to look for a difference.
[9:42pm] Bdragon|vocalo: Basically all the stuff in hook_nodeapi has a matching function
[9:42pm] stompeers___: So, you could create a custom node type, but still be able to add CCK fields, right?
[9:42pm] Bdragon|vocalo: Yeah
[9:43pm] Bdragon|vocalo: There's a handbook section on writing a node module...
[9:43pm] stompeers___: So, I could draw some data from custom tables, but also connect those tables with nodes when I needed to...
[9:44pm] stompeers___: Can you create multiple node types with a single module?
[9:44pm] Bdragon|vocalo: http://drupal.org/node/162170
[9:44pm] Druplicon: http://drupal.org/node/162170 => Creating new node types - tutorials => 3 IRC mentions
[9:44pm] Bdragon|vocalo: Yeah
[9:44pm] |igor_ left the chat room. (Read error: 113 (No route to host))
[9:44pm] Bdragon|vocalo: hook_node_info?
[9:44pm] Druplicon: hook_node_info: Define module-provided node types. => hook_node_info() => http://api.drupal.org/api/function/hook_node_info/5
[9:44pm] gusaus_ joined the chat room.
[9:44pm] Bdragon|vocalo: You define the prefix to use with the 'module' key
[9:45pm] stompeers___: That's great. So (just thinking out loud here), I could set up node types for each of my tables (masters, sales orders and work orders), and have the flexibility of creating my own forms and working with my own tables, but also be able to use Views and extend functionality with CCK if need be. Does that sound right?
[9:46pm] Bdragon|vocalo: Well, you'd have to inform views about the fields you manage yourself, but yeah
[9:46pm] jims_ joined the chat room.
[9:46pm] stompeers___: That can be done with some hook function, I would gather?
[9:46pm] Bdragon|vocalo: Yeah
[9:46pm] stompeers___: Sweet!
[9:47pm] Bdragon|vocalo: http://drupal.org/handbook/modules/views/api
[9:47pm] stompeers___: I've been putting off this project for a while because I haven't been able to wrap my mind around how to approach it. I really appreciate you talking it through with me!
[9:47pm] Bdragon|vocalo: No problem
[9:47pm] doviov joined the chat room.
[9:48pm] Bdragon|vocalo: Views knows about CCK fields because CCK implements the views hooks to tell views about them.
[9:49pm] chode_ joined the chat room.
[9:51pm] stompeers___: Thats great. CCK gets smarter the more I learn about it. Thanks so much! It great talking with folks that know their Drupal stuff.
[9:51pm] Bdragon|vocalo: no problem

Resolution

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.