I try to add some fields to content type through this hook as it done in node_example module in Drupal 7 examples but it's not even invoked. What can be wrong?

function education_node_type_insert($content_type){
            $fields = _anketa_installed_fields();
            foreach($fields as $field){

            $instances = _anketa_installed_instances();
            foreach($instances as $instance){
                $instance['entity_type'] = 'node';
                $instance['bundle'] = 'anketa';
  • Are you sure your custom module is enabled? Did you clear cache after you added the implementation of hook_node_type_insert? Jul 30, 2013 at 19:57
  • Yes, I even tried to disable and enable it back several times. Same thing with clearing cache Jul 30, 2013 at 20:42
  • Out of curiosity what is it you are trying to accomplish? Jul 31, 2013 at 9:22
  • I'm just trying to create content type and add fields to it. In node_example example from drupal.org it works but in my case - doesn't. Just can't figure out why. Jul 31, 2013 at 14:56
  • Why not use the Features module to export your field definition? Aug 1, 2013 at 15:05

1 Answer 1


This hook will only get called when node_type_save() is called - ie. when a new node type is saved to the database.

  • So the type should be saved in hook_install anyway? Jul 31, 2013 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.