Created
          June 12, 2014 13:06 
        
      - 
      
- 
        Save batandwa/84bb5e680422fe591771 to your computer and use it in GitHub Desktop. 
    Drupal 7 - Custom block hooks
  
        
  
    
      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 | |
| /** | |
| * 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