Proposal is currently available on the GSoC website:
http://socghop.appspot.com/student_proposal/show/google/gsoc2009/jkitchi...
Abstract
It is often the case where at first it may seem most fitting to design a content type through CCK, and then customize the way nodes of that type are displayed throughout the site. But there are instances when needs grow too complex and a custom module is needed. This process can be automated in order to encourage a natural workflow in growing from a simple site to a more complex one.
Overview
A module that allows conversion of an existing CCK content-type and/or a particular view into a module that can be extended and modified by the programmer. This allows for a natural progression from web application with simple needs to one with complex ones only met with a custom module.
Description
Have you ever stretched a particular View to the limits of what is possible? Maybe you needed to display all nodes with a title starting with a vowel -- but only the first one for each vowel. Sure, you can place complex logic like that in a Views argument box as PHP code, but is that the Right Thing to do?
There are many cases when your CCK and Views needs grow too complex for the abilities provided by the graphical interface. This not only provides the advantage of giving you maximum flexibility, but also moving your code and content-type definitions out of the database and into a plain-text, editable file. Another huge advantage of keeping site structure out of the database is that it can be version controlled, which is especially useful as complexity increases.
How will this be accomplished? Well, currently each CCK content-type and View can be exported to a data structure written in PHP code. We can develop a layer that takes this information and processes it into a human-readable module that can be extended and modified at will. (This is somewhat equivalent to generating a PHP template file whilst developing Views themes.)
Future possibilities allow for extending this system into a framework where "modules" can be re-imported back into CCK/Views via a multi-directional conversion process. This may limit the amount of customization on the "modules" themselves, however it would be useful to fulfil the needs of both developers and GUI users in modifying site functionality.
Comments
Implementation Details
What we want to have is two layers of standalone modules. The first is the content-type, and the second is the "views" of said content.
Content-Type Modules
These could take advantage of the new Fields development in D7. It would be possible to come up with a loose framework of what a module like this would look like (a template, if you will), and then programatically generate it whenever an export is requested through some Drupal admin GUI. The key here is to make it as human-readable as possible. This allows for any simple changes, as well as possible custom handling of content (e.g. easily add hooks on creation/deletion of nodes).
Workflow here could be quickly mocking up content-types in a GUI, and then exporting them to start versioning them, and so that easy changes can be made from the programmer's perspective.
Views Modules
What we want here is already complete in a sense. Below is an excerpt of your standard export of a view in Drupal.
$view = new view; $view->name = 'dealers'; $view->description = 'Listing of available dealers'; $view->tag = 'Dealers'; $view->view_php = ''; $view->base_table = 'node'; $view->is_cacheable = FALSE; $view->api_version = 2; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->override_option('fields', array( ... ));However, in addition to being extremely hard to modify (who knows the exact options you can override and the order in which Views expects their parameters?) it also relies on Views to produce anything useful. We want to break that dependency -- include just enough code so that it can create whichever page or block that is needed. Again, the advantage here is that we have complete control over this module, and can add custom functionality or extend it into a completely different and complex module if we wish.
Workflow here could be creating an initial view of some content-type, exporting it in this new fashion, and versioning it. From there many more powerful customizations can be made than allowed in the Views edit page. (Ever tried to show a list of links to nodes alphabetically but only showing the first three of each letter in the alphabet?)
Backporting
Of course there is some merit in having a GUI available -- if there is enough time then it would make sense to make this process bidirectional. Granted, it would only remain that way if the programmatic changes made could also be accomplished via the GUI. This would also limit the syntax of the file somewhat if it needs to be read in and interpreted consistently.
An interesting way of doing this would be in a completely passive and automatic way -- keep corresponding textual modules to a subset or to all content-types and views. If the modification dates on said files changes, read and import them into Drupal. If they are changed in the Drupal administration interface, then output them overtop of the existing files. This makes for a very powerful dual-track system.
Timeline
Can any of the mentors on here think of cases where they might find something like this useful? What kind of features would be most important to you and the Drupal community?
maintenance
Hi Joel,
Unfortunately it is too late to submit any new proposals for GSoC.
Now considering your idea, it seemed a bit like you are proposing an automatic forking system, to split off new modules from the Views/CCK projects. This might seem like an easy fix when you need new functionality that is not available yet, but it is a really bad idea from a maintenance perspective.
When you hit the boundaries of existing modules you should:
-create the new functionality in a contrib module (make it independent from the specific node and views objects you will be using)
-optionally build a package with the configurations of views, CCK and your add-on module
Hope you'll send in a proposal again next year!
--
I blog and Tweet
--
Check out more of my writing on our blog and my Twitter account.
Features
Hi,
I believe [features] would be a good place to start.
cheers