[drupal-devel] Standard set of objects and methods?
nedjo at gworks.ca
Mon May 2 18:26:15 UTC 2005
How can we improve parallelism between the various object types in
Drupal? Should we be providing a standard way to determine available
object types? Should we create common methods for all?
As object types, we have (at a minimum) nodes, vocabularies, terms, and
users. We might also consider, e.g., modules, themes, and file uploads
as core object types. In many cases we might wish to do parallel things
with each object type (track it, display it, interact with it), but at
present we need to do this somewhat differently for each.
Example 1: extended information. We sometimes want to display
additional information about an object being viewed (who created it,
when, how often it has been viewed, etc.). But we would need to do this
differently for each object type (user, node, term, etc.), and some
entirely lack methods.
Example 2: statistics. We track statistics by node. But what if we
also want statistics on users, terms, etc.? We'd need separate tables
(term_statistics, user_statistics, etc.) and separate methods.
Example 3: associated images. We want to associate images with objects.
For users we put a file reference in the user table field, for terms
(via a contrib module) in a term_images table, for themes somewhere else.
Potential solution/approach: object abstraction. Methods prepared to
meet any kind of object. And a way for object types to register
themselves, so a list of available types can be accessed.
Would this make sense?
More information about the drupal-devel