Refactoring CCK and connection with views

markfoodyburton's picture

My idea started out being simple, I wanted a view in which some (but not all) of the fields were editable.

An increasingly large can of worms has opened up... see the post here:

I'd really appreciate feedback... I would like to know that what I'm doing will be useful, so please comment!

This is now working, and a patch is attached. It is a patch against the DRUPAL-5 release of both cck and views, and is attached here.

There are two "issues" to track the CCK and Views part of this work: (for the views issues) (for the CCK issues)

The two issue pages have the patches relevant to those modules attached individually.

(PLEASE use this page to talk about this overall functionality, and the two issue pages for issues with respect to those modules, dont add more comments to

editablefields.patch_.2.txt14.51 KB


BTW, I started from here,

markfoodyburton's picture

BTW, I started from here,, I'm not sure that patch is helping me too much, but I've taken the patch anyway :-)

In the patch's I've submitted, I've removed that patch, as I ended up not being able to make use of any of it, so my patches are against the CVS DRUPAL-5 tag....

subscribe +1

toursheet's picture

Hope this agrees with Drupal 6.x


mooffie's picture

I'll keep an eye on this.

BTW, I thought you were writing a new Views "style plugin". I now understand these "editables" would work whithin the existing Table/List plugins.

Yes, the functionality I

markfoodyburton's picture

Yes, the functionality I want to see could be used with any existing type of view - it works for list and table right now, but I think it could be made to work with any other too...

BTW, what I really need is feedback on the code (for both patches), so I can make any fixes needed. I dont intend to develop much more on the patch as such - I hope others will take on some of the "to-do's" (like other view types). Meantime, I hope that the functionality in the patch can be included soon, so people can use it and suggest improvements...



Please take new patch

markfoodyburton's picture

I am terribly sorry, somehow the patch to the views_ui.module file didn't make it into the patch I released previously. Please take this patch (2) instead. I'll cross post to the views module.

Problems with CCK

markfoodyburton's picture

Everything seemed to be working fine, until I used this with a node reference type on the form (but not editable)

The problem SEEMS to be that some CCK types rely on the form to maintain there value, so you can't simply validate and submit without the form elements being there, as the value disappears.

The issue is that the CCK deals with the whole node, not just individual form elements.

The solution I am currently using is to mask out changes to the form values from fields that should not be touched. It's a little ugly, but it seems to work for now. I will continue checking, and post a new patch soon.

Cleaner Implementation

markfoodyburton's picture

I've now re-implemented the whole scheme, using a module. This has totally removed the need for a patch to the views module - thanks to merlinofchaos for pushing me in the right direction...

There is a feature of this implementation: the "flag" marking a field as editable is now generated from the cck, and appears as an option. This actually makes PERFECT sense. Other handlers (like "as a link" or whatever) make no sense in the context of editable, in other words, editable is just one "option" choice - perfect.

However, in order for this flag to be taken into account, the view "type" needs to be set to editable table or list. This is wrong, the "edit-ability" of fields should be just a property of the fields (and their options), and nothing to do with whether the thing is a table or a list.

However, in order to make this thing fit, right now, thats the way it is - and I'm not sure anything other than table makes much sense anyway. So I think it's a limitation we can live with.

So, there is a shiny new module that "does it all" - its called editablefields see /project/editablefields.

The minor down side is that this module STILL relies on a patch to the CCK, and now the patch is a little tiny bit bigger.
The CCK needs to have a function that allows individual fields to be programatically rendered (this was the major part of the patch), and second it needs to indicate that fields CAN be editable (i.e that the option shows up in the view).

The patch for CCK can be found at /node/156444

I would love to make this independent of a CCK patch, and would welcome some help on that.

patch cck

moshe weitzman's picture

i think this makes sense within cck - lets not workaround if the right way is a patch. i am sure yched and karens will consider it.

great work.

Thanks :-)

markfoodyburton's picture

Thanks :-)

So - in the end I've

markfoodyburton's picture

So - in the end I've replicated the code from the cck module, so now this module lives on it's own, and needs no patches from either CCK or Views - there are down sides, and I personally HATE replicating code - but the up side is that it works and nobody has to patch anything. - seems like a long journey to get close to the destination - but I think I'm there :-)

Sorry for slowing you down

KarenS's picture

Sorry for slowing you down by balking on your proposed CCK patch. That still might be done if anyone gets a chance to spend enough time to be sure it won't break anything. It's just that we've all been burned when we committed patches that looked innocuous but created havoc in some situations, so we have to be careful about that. Plus, like I said, the widget handling is likely to change quite a bit in 6.x already, and that might be a better time to think about incorporating the changes in your patch.

Anyway, this is a very interesting project and I can see lots of uses for it, so thanks for all the work!

I was looking for a module

zackai's picture

I was looking for a module for bulk editing and ran into this module. Just tried it on with D7 and works well. This module rocks. Thank for the excellent work.

@zackai - What version of D7

bulldozer2003's picture

@zackai - What version of D7 are you using and what additional modules are you using? You don't have any errors while using this module? I am using 7.8 and I get an AJAX error when editing an editable field ( and an issue with node titles disappearing (