简体   繁体   中英

Drupal 7. How to add a piece of reusable html (or a block) to the main content field

My website is built with Drupal 7. I created a block containing an html table that I would like to add to selected pages via a content field accepting html or php code.

I know how to add blocks to regions, but I can't find if I can add reusable html blocks inside fields (ie page content itself)

You could print your block(s) from code like:

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

https://drupal.stackexchange.com/questions/121650/render-custom-block-by-block-name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM