I have created this simple module (named "youtube"):

echo 'outside function';

function youtube_view($node, $view_mode) {
   echo 'inside function<br />';

    return $node;

I can only see the echo outside of the function. I've tried numerous hooks and I can't get any of them to work. The only thing different is that I am a new user to Drupal 7 and this is created on a multi site.

My structure for this module is:


And the site can see it fine as I have enabled it in the backend.

Do you have any idea on why this happens?

  • use the dpm() function from the devel module if you want to debug, not echo – karthik Oct 27 '11 at 11:41

Hook implementations are cached in Drupal 7. After adding a new hook, you need to clear the cache for example using the devel block or drush cc all.

Also, hook_view() is not actually a hook. It is callback that is only invoked for the module which provides the given node type.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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