I am bit confused about
hook_validate() and case 'validate' in
hook_nodeapi(). Both do validate a node.
Could anyone clear me the difference with a simple example that even a beginner can understand?
For example, let's say you created a node type with a specific field in it of "area" and you wanted to make sure it was of the format city-state. You would do it in here.
For example, let's say you wanted to make sure a description field in a node with that field had more than 1000 characters. You would do it with
The main difference is the following:
hook_validate: when you create a new content-type programmatically you can use a certain number of hooks for define a how will be behave your new content-type, you can see these hooks in the developer hooks section of Drupal site, between that hooks exists hook_validate for apply a validation for your new content-type.
validate in hook_nodeapi: with this, you can add any validation for a node for any content type .