Computed Field

Slug: 
computed_field
Versions de Drupal: 
5.x
6.x
7.x
D.o - Installation Rank: 
89
D.o - Reported Installs: 
11 812
D.o - Maintenance Status: 
Seeking co-maintainer(s)
D.o - Development Status: 
Unknown
D.o - Module Categories: 
Content, Content Construction Kit (CCK), Developer
D.o - Download 4.7: 
D.o - Download 5.x: 
5.x-1.2|http://ftp.drupal.org/files/projects/computed_field-5.x-1.2.tar.gz|10.72 KB
D.o - Download 6.x: 
6.x-1.0-beta4|http://ftp.drupal.org/files/projects/computed_field-6.x-1.0-beta4.tar.gz|14.32 KB
D.o - Download 7.x: 
7.x-1.x-dev|http://ftp.drupal.org/files/projects/computed_field-7.x-1.x-dev.tar.gz|15.06 KB
D.o - Original Description: 

Maintainers

Computed Field is being maintained by Moonshine (Drupal 6 & 7 branches) and Agileware, http://www.agileware.net (Drupal 5 branch).

Note: CVS HEAD is not actively used. Active Drupal 6 development is on DRUPAL-6--1 and Drupal 7 development is on DRUPAL-7--1.

If you would also like to help maintain this module then please contact Moonshine or Agileware.

Drupal 7 Notes

An initial development version for Drupal 7 is available for download and CVS checkout on the DRUPAL-7--1 branch. A few notes:

  • This is an initial port, I expect there are bugs to crush. Please report what you find. :)
  • I have not looked at content migration from D6 yet, but it will likely be tricky given the DB options computed field offers and item below.
  • The variables used for computation have changed because D7 now has fields and i8n support in core. The new variables are noted on the field forms, but be aware they are different from D6!
  • Because D7 has fields in core, Computed Fields can now be attached to users as well.
  • There is initial Views support, but more work needs to be done.
  • There is initial suport for Locale/i8n that's in D7 core

About Computed Field

Computed Field is a very powerful CCK field module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code. You may draw on anything available to Drupal, including other fields, the current user, database tables, you name it. (Feeling the power yet? :) ) You can also choose whether to store your computed field values in the database with other content fields, or have them "calculated" on the fly during node views. (Although you should note that Views use requires database stored values.) This field is literally the Swiss Army knife of CCK fields. So start cooking up your PHP based values!

Important

This module is intended to be used by PHP developers to insert & execute PHP code on a Drupal website. It does not provide a macro interface, a code builder or anything other than insert your working code here into this text area. You need to have a good working knowledge of PHP and the Drupal API to use this module. To get the best results with this module, pre-test your PHP code in the Body field of a Page in Drupal.

Please do not post questions to the issue queue asking for help with your specific PHP code snippet. Use this page for Computed Field code examples and for seeking assistance, http://drupal.org/node/149228

Usage

Getting Started

Before you can use Computed Field, you'll need to get CCK and enable (at the very least) the 'content' module. You will probably also want to enable the other CCK modules, such as 'text', 'number', 'date', etc.

To add a computed field to a content type, go to administer > content > content types, select the content type you want to add to, and click on the 'add field' tab. One of the field types available should be 'Computed', and it should have one bullet point under it, also labelled 'Computed'. If you select this, give your field a name, and submit the form, you will get to the configuration page for your new computed field.

Configuration and examples

Configuration of this module has been relocated to a page of the CCK manual on drupal.org.
http://drupal.org/node/126522

If you have another useful (or instructive) example please add it to the manual pages.

Souscrire à DrupalFrance.com RSS