Computed Field is a very powerful 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 fields. So start cooking up your PHP based values!


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 unpaid help with your specific PHP code snippet. They will generally be ignored or closed. Use Computed Field code snippets for code examples and seeking assistance. If you have another useful (or instructive) example please add it to the manual pages, and if you'd like to help with support, please answer support questions over there.

If you are looking for paid support, you may post a support request in the issue queue marked as such. These may be picked up by anybody, as the current maintainers don't have time to work on such issues.

To get started, make sure to follow the documentation link to the right.

Note: The "master" GIT branch for this project is not actively used. Active Drupal 6 development is on branch 6.x-1.x and Drupal 7 development is on branch 7.x-1.x.

Drupal 7 Notes

  • There is no upgrade path from D6. It would likely be tricky given the new DB Abstraction Layer and the new Fields API.
  • The variables used for computation have changed because D7 now has fields and i18n support in core. The new variables are noted on the field forms, but be aware that they are different from D6!
  • Because D7 now has fields in core, Computed Fields can now be attached to other entities (e.g. users, taxonomy terms). If there are any problems with this report over at #1262724: Generic entity support.
  • There is initial Views support, but more work needs to be done.
  • There is initial suport for Locale/i18n that's in D7 core.

Drupal 8 Notes

  • There is no upgrade path from D7 or D6.


An alternative to this module is Views PHP. It lets you add code to Views from the Web UI, but you can't implement hooks in your own modules for your computations, at least not yet. See #1326780: Provide function templates for code to use instead of text areas for the feature request.

Math Field is another potential alternative for field calculations in D7.

Maintainer Information

Computed Field was being maintained by Moonshine (Drupal 6 & 7 branches) and Agileware, (original developers & Drupal 5 branch), but it is now maintained by colan (mostly D7, but will accept RTBCed D6 patches as well). D8 version is maintained by dealancer.

Supporting organizations: 
Drupal 7 maintenance

Project Information