The $content variable is really useful when writing templates, but I've found that it's not fully populated when using a custom view mode.

I'm using node_view to create a render array of a node. When I use "full" or "teaser" view modes, the "content" variable of the array is populated with lots of render information as we're accustomed to using. When I specify a custom view mode, which I have defined using hook_entity_info_alter, this variable is sharply less populated.

What is special about the built in "full" and "teaser" modes that causes drupal to fully populate the render array?

  • 2
    It might be that you need to visit admin/structure/types/manage/page/display and see if your view mode is showing up there on the top right. Then verify that you have fields set to display in those view modes. – paul-m Jan 14 '12 at 5:30
  • Thanks for the idea, but the view mode is listed and the fields are set to display. – BC01 Jan 16 '12 at 17:55

Your Answer

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

Browse other questions tagged or ask your own question.