Created
June 6, 2013 19:43
-
-
Save tmbritton/5724325 to your computer and use it in GitHub Desktop.
Drupal Create Block
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
/** | |
* Implements hook_block_info(). | |
*/ | |
function YOUR_MODULE_block_info() { | |
$blocks = array(); | |
$blocks['YOUR_BLOCK_ABC'] = array( | |
'info' => t('YOUR BLOCK NAME'), | |
); | |
return $blocks; | |
} | |
/** | |
* Implements hook_block_view(). | |
*/ | |
function YOUR_MODULE_block_view($delta = '') { | |
$block = array(); | |
switch ($delta) { | |
case 'YOUR_BLOCK_ABC': | |
$block['subject'] = ''; | |
$block['content'] = _YOUR_MODULE_BLOCK_ABC_CONTENT(); | |
break; | |
} | |
return $block; | |
} | |
function _YOUR_MODULE_BLOCK_ABC_CONTENT() { | |
$output = t('Hello world'); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment