Community Documentation

CCK Hook Execution Order

Last updated December 4, 2008. Created by Chris Johnson on December 6, 2006.
Edited by KarenS. Log in to edit this page.

CCK Hooks are called by the field, the widget, and by the content module's field hook (content_field).

Here is the order that hooks execute when submitting a existing node (displaying the name of the hook and the operation):

  1. widget prepare form values
  2. widget form
  3. widget validate
  4. widget process form values
  5. field validate
  6. content_field validate
  7. widget submit
  8. widget process form values
  9. field submit
  10. content_field submit
  11. field update
  12. content_field update

And here is the order when creating a new node:

  1. widget prepare form values
  2. widget form
  3. widget validate
  4. widget process form values
  5. field validate
  6. content_field validate
  7. widget submit
  8. widget process form values
  9. field submit
  10. content_field submit
  11. field insert
  12. content_field insert

Here is the order on a preview:

  1. widget prepare form values
  2. widget form
  3. widget validate
  4. widget process form values
  5. field validate
  6. content_field validate
  7. widget process form values
  8. field view

There is some (probably) unnecessary duplication going on, so I have proposed a patch at http://drupal.org/node/88921 to eliminate the second 'process form values' widget operation, along with the widget validate and submit. If that patch gets committed, those operations could be removed from the above lists.

About this page

Drupal version
Drupal 4.7.x, Drupal 5.x

Structure Guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here