Skip to content

Instantly share code, notes, and snippets.

@WeeHorse
Created April 14, 2014 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WeeHorse/10641063 to your computer and use it in GitHub Desktop.
Save WeeHorse/10641063 to your computer and use it in GitHub Desktop.
<?php
// implements hook_block_info
function block_from_current_node_block_info() {
$blocks = array();
$blocks['block_from_current_node'] = array(
'info' => t('Block from current node'),
'cache' => DRUPAL_NO_CACHE
);
return $blocks;
}
// implements hook_block_view
function block_from_current_node_block_view($block_name = '') {
if($block_name == 'block_from_current_node'){
return array(
'subject' => t('Block from current node'),
'content' => get_content_from_current_node()
);
}
}
function get_content_from_current_node(){
//header('Content-type: text/plain; charset=utf-8');
//var_dump(func_get_args());
//drupal_exit();
var_dump(menu_get_object());
return $yourCustomHtml_or_page_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment