Created
December 12, 2013 14:27
-
-
Save reli/7928716 to your computer and use it in GitHub Desktop.
Blocks block render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Printing the blocks | |
| /* Print custom block content */ | |
| $block = module_invoke('block','block_view','1'); | |
| print render($block['content']); | |
| /* Print the whole custom block (with divs, title etc.) */ | |
| $block = block_load('block','1'); | |
| print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); | |
| /* Print a views block */ | |
| $block = module_invoke('views','block_view','print_block_test_view-block'); | |
| print render($block); | |
| ?> | |
| /* | |
| Parameters for the functions: | |
| module_invoke($module,$hook,$delta): | |
| block_load($module,$delta) | |
| $module = module name (like block or views) | |
| $hook = hook inside the module to invoke (like block_view) | |
| $delta = identifier of the block (like test_view-block or 1) | |
| You can find the right module and delta name for the block when hovering configure link in blocks page in #overlay=admin/structure/block | |
| Example: | |
| #overlay=admin/structure/block/manage/block/1/configure | |
| #overlay=admin/structure/block/manage/views/test_view-block/configure | |
| */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment