2

Basically I created a webform and enabled it as a block, now I want to put that block inside a specific node. I can do that by placing it in a 'content' region and defining the specific node BUT it displays at the end of the content. Now how can I move it between specific elements inside the content?

The node is using a page-type....tpl.php which is used by 5 other nodes as well so I cannot change the code.

To visualize it looks like:

[ content ]

-description text-

-list of videos-

[ end of content ]

and I need to put my webform between the text and the video list. Is there a way?

  • In the end I used a node--[nid].tpl.php to break the content into elements and insert my form into the specific place. That was the fastest and easiest way in my case. – Caroline_710 Aug 27 '15 at 13:51

3 Answers3

1

There are many roads you could take, but since you said you're considering the template file: Why not use a node-specific template, since page is a node type?

Say you're on node/123, then you could use a template named node--123.tpl.php (see Drupal 7 Template (Theme Hook) Suggestions) and embed your block right there.

Alternatively, you could provide a reusable token in a custom module via hook_token_info and combine it with the commonly used token_filter module. But that might be over the top, if it's just one node you need to touch.

ckaotik
  • 191
  • 1
  • 5
0

For Drupal 7 a bit of a hacky way to display the contents of a block in content would be to enable the PHP Filter module. Then edit your node and switch to the PHP code Text format and add this code

 <?php
     $block = module_invoke('block', 'block_view', '1');
     print render($block['content']);
 ?>

where '1' is the block id found in the URL when you edit the block and be sure to include the PHP tags.

Also see this page https://www.drupal.org/node/26502 for more information on placing blocks.

Jon
  • 569
  • 4
  • 7
  • Thank you for the answer but unfortunately, although the PHP Filter module is enabled, my php code put inside a node is not working. I am a noobie when it comes to drupal so guess I will make a new node tpl instead. – Caroline_710 Aug 27 '15 at 08:02
0

You can use the EVA module to add the webforms in the node as a field.

You basically create a view and choose the "eva field" option then you make sure that this view selects only the webforms you want to have and relates it to the node (the EVA module documentation has much better examples than I can provide).

After you have added it as a field you can place it anywhere in the node.

There is also the Block reference module that could help you.

Byte_Monster
  • 313
  • 3
  • 14