Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I've read through many questions asking this same thing, but I feel like I'm doing what they are suggesting and it's still not working.

I've created a custom module and enabled it. This is my code:

function mymodule_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'teaser' && $node->type == 'article' && count($node->field_video) > 0) {

    $markup = sprintf("<video style='width: 502px; height: 282px;' poster='%s'>\n",
        image_style_url('video_thumbnail', $node->field_video[$node->language][0]['thumbnailfile']->uri)

    foreach($node->field_video[$node->language][0]['playablefiles'] as $video_object) {
      $markup .= sprintf("<source src='%s' type='%s' />\n",

    $markup .= "</video>";

    $node->content['field_video_embed_code'] = array(
      '#markup' => $markup,
      '#weight' => 10,
      '#type'   => 'markup',



When I look at the krumo output, I see my changes to the $node object, however, when it renders the new field I'm adding is not included.

What am I doing wrong?

EDIT: I just realized I'm using Display Suite (it's been awhile since I set this site up) which is overriding which fields are shown and in what order. My guess is that DS is getting my modified content, but not showing the additional field because it isn't listed in my teaser fields? I'm not sure.

share|improve this question
Please provide code of node template file. Maybe you don't output $node->content directly. –  Eugene Fidelin Jan 10 '13 at 9:31
I am using a Zen sub-theme and I haven't overridden Zen's node template, but I'll include it above anyway. –  Kenny Wyland Jan 10 '13 at 22:29
have you inspected the page source to make sure the <video> tag is definitely missing form the HTML, and not just invisible for some reason? –  Chaulky Jan 11 '13 at 3:16
Yes, I have looked at the raw source in addition the DOM inspector. The video tag is definitely missing. –  Kenny Wyland Jan 11 '13 at 3:59
What happens if you do a dpm($content) in the template file? Is your field in there? (dpm needs devel module). –  2pha Jan 11 '13 at 4:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.