Hey everyone,

With the beta release of Drupal 7 right around the corner, I wanted to see if anyone had begun planning of a Drupal 7 port. Our shop has mostly shifted to Drupal 7 development and I 'm interested to learn if any work has begun on D7....

Thanks,
Ben

CommentFileSizeAuthor
#5 795278-port_d7.patch24.2 KBdawehner

Comments

sahuni’s picture

subscribe

willeaton’s picture

subscribe - this is an invaluable module!

dawehner’s picture

dawehner’s picture

Now the calculation worked fine, but the value is not shown yet.

dawehner’s picture

StatusFileSize
new24.2 KB

Here is also a patch. The patch is based on DRUPAL-6--1

aren cambre’s picture

#902544: Is this module supported?

Check that issue in 2 weeks, and if no response, follow steps in linked abandoned projects process to get ownership changed.

off’s picture

Subscribe

Moonshine’s picture

@dereine - Thanks for your work! I'd be more then happy to give you commit access to start up a D7 branch. I was actually looking at starting the D7 update process myself here soon, but would gladly help work with your code. Just let me know if you want access via my user contact form here on D.O. Thanks.

dawehner’s picture

I'm not really sure whether this is a good idea :) My time is sadly quite limited so you shouldn't trust me.

Moonshine’s picture

Funny... Thanks for your work though. I'll run through it this week and start up a 7.x branch on the project here next weekend. Let me know if you re-consider ;)

corbacho’s picture

subsc.

Moonshine’s picture

Assigned: Unassigned » Moonshine
Category: support » feature
Status: Active » Closed (fixed)

I've started up a Drupal 7 branch (DRUPAL-7--1) and committed and initial "working" version. It should appear as a "dev" download on the project page shortly.

By working I mean you should be able to create computed fields on entities (nodes, users, etc.) with custom computation and display code, have values (optionally) saved to the DB, values displayed with entities, tokens exposed, initial locale/language support (that's in D7 fields now), optionally add a simple DB index on the field values, and basic Views support (that's part of being a D7 Field).

At this point I haven't had the time to look at:

- Better Views integration. Things like "Greater Than" filters for numeric types, etc.

- CCK content migration for fields from D6 to D7. This will will probably be quite ugly for Computed Field, as variables in user's computed code and display code must change now that D7 has a field system. entities, and i8n support in core.

At this point I'm going to mark this issue closed, and people can post individual bug reports under the new branch. Hopefully some of the other maintainers will jump in on development as well, as my time is very limited ATM.

And thanks again to Dereine for getting things started!

Moonshine’s picture

I should have also mentioned, translations will need some re-doing if you depend on one. :/

mehtatejas’s picture

when can we expect stable release of computed fields module for drupal 7 ?

rorymadden’s picture

Title: Drupal 7 port » Drupal 7 port (Computed Field)

subscribe

batymahn’s picture

Title: Drupal 7 port (Computed Field) » Understanding Computed Fields in Drupal 7
Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » support
Status: Closed (fixed) » Needs review

I'm kind of new to Drupal and trying to understand Computed Fields in 7.x.1.x-dev so I created a 'test' content type. 'test' has 2 text fields, name1 and name2, and 2 integer fields, num1 and num2. My first Computed field, combinedname, looks like:

PHP Code:
$entity_field_combinename[0]['value'] = $entity->field_name1[LANGUAGE_NONE][0]['value'] + $entity->field_name2[LANGUAGE_NONE][0]['value'];

Display Code:
$display_output = $entity_field_combinename_item['value'];

My second Computed field, add, looks like:

PHP Code:
$entity_field_add[0]['value'] = $entity->field_num1[LANGUAGE_NONE][0]['value'] + $entity->field_num2[LANGUAGE_NONE][0]['value'];

Display Code:
$display_output = $entity_field_add_item['value'];

When I enter content I don't get any output. I'm obviously missing something. Any pointers would be appreciated.

kunago’s picture

@batymahn: I am not really sure how Computed Field works at the moment but your PHP code does not seem to be right. You should be using "+" when adding two numbers together which should be fine for the numerical fields. This, however, might not work as you expect with the "name" fields (supposing they are strings) where you'd better avoid the "+" operator and use "." instead.

batymahn’s picture

Thanks kunago. I'm a JAVA guy, still not used to PHP strings. The number code, however, is almost a direct quote from the example given when you set up the field; I only changed the name of the fields, including the computed field. I don't understand why I get nothing when I look at my published content.

waverate’s picture

One of the drawback I find with Computed fields is that there is really no good place to test the Computed PHP Code by printing variables and such.

The only way I am doing that now is by making a text.php file and putting the code in there with some hardcoded values for the variables. If the code runs from the command line, I paste it into Computed Code and copy over the correct field names. It helps with getting the syntax correct.

How I miss print_r($node).

AtomicTangerine’s picture

Title: Understanding Computed Fields in Drupal 7 » Drupal 7 port (Computed Field)
Version: 7.x-1.x-dev » 6.x-1.x-dev
Category: support » feature
Status: Needs review » Closed (fixed)

almost year-old closed issue hijacked
Please create new issues or go here for coding help: http://drupal.org/node/126522 (http://drupal.org/node/149228 from this module's project page) :)

sidenote to waverate: try the devel module, it has some great functions for printing variable beautifully ;)