Last active
August 29, 2016 13:32
-
-
Save v1talii-dev/a88009b0ed0173daa9a91b1467aa381b to your computer and use it in GitHub Desktop.
D7: programmatically create block
This file contains 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 | |
/** | |
* Implements hook_block_info(); | |
*/ | |
function hook_block_info() { | |
$blocks['test'] = array( | |
'info' => t('Description'), | |
'cache' => DRUPAL_NO_CACHE, | |
); | |
return $blocks; | |
} | |
/** | |
* Implements hook_block_view(). | |
*/ | |
function hook_block_view($delta) { | |
// Block view only "test". | |
if ($delta != 'test') { | |
return; | |
} | |
$block = array( | |
'title' => t('Title'), | |
'content' => 'Test', | |
); | |
return $block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment