[development] nodify.module idea: 'everything is a node'
nedjo at islandnet.com
Fri Jan 19 20:31:11 UTC 2007
An idea I'm hoping for some feedback on before wading into coding.
As Drupal devs we've often talked about how to give all Drupal objects
(terms, vocabularies, users, nodes, etc.) all the features of nodes. Instead
of relying on separate APIs and methods and access control etc. for each
object type, we look for a single system that each of these could tap into.
Instead of implementing separate ways of adding characteristics (e.g., user
profiles), we look for all the benefits of a single, soundly developed one
I'm pondering a 'nodify' module that would accomplish these aims through
attaching content.module content types to each object.
Create a user/role/term/vocabulary and it gets all the characteristics of an
admin-configurable content type.
We already have similar implementations. One I've been looking at with
interest is fago's usernode module. It's a node type module that attaches
nodes to users. (The module can be manually edited to instead use a
different, e.g., CCK, content type.)
Basically we'd do the same thing, with two differences:
1. instead of doing so for just one Drupal object type (users), we'd
construct a set of methods that could apply to all types.
2. instead of implementing a custom node type through a node module we'd use
content.module to create a new, extensible node type (getting the advantages
of being able to add fields).
As a result, we'd be able to do things with non-node objects like:
- attach anything implemented through nodeapi (e.g., mailing)
- implement access control through node_access modules
- add CCK field types
- expose directly to views
- control rendering through nodapi 'view' op
Specifically, I'd see:
1. A core set of handlers and methods, like:
- nodify_create_content_type() to create a content type with a name llike
- nodapi hook implementation
- hook to load data on supported object types
- custom hooks as needed to call methods in all supported object types. e.g.
nodify_help() might call help in all support object types' .inc files for
messages specific to that object type, e.g., a term.
2. For each module with a one or more supported object types, an include
file (e.g., taxonomy.inc for terms and vocabularies, user.inc for users and
roles) with specific methods:
- hook implementation to describe available supported object types. E.g.,
taxonomy.inc would return something about supporting 'term' and
- custom hook implementations, e.g., of nodify_help.
- hook implementations (user.inc implements hook_user(), taxonomy.inc
implements hook_taxonomy) to attach
- form alters: e.g., term editing form is altered to add the node edit form
for 'nodify_term' content type.
- views hooks
- does this approach sound useful?
- who's working on something similar? better?
- anyone wanting to work on this?
More information about the development