function block_example_block_view

Implements hook_block_view().

This hook generates the contents of the blocks themselves.

Related topics

File

block_example/block_example.module, line 131

Code

function block_example_block_view($delta = '') {
    // The $delta parameter tells us which block is being requested.
    switch ($delta) {
        case 'example_configurable_text':
            // The subject is displayed at the top of the block. Note that it
            // should be passed through t() for translation. The title configured
            // for the block using Drupal UI supercedes this one.
            $block['subject'] = t('Title of first block (example_configurable_text)');
            // The content of the block is typically generated by calling a custom
            // function.
            $block['content'] = block_example_contents($delta);
            break;
        case 'example_empty':
            $block['subject'] = t('Title of second block (example_empty)');
            $block['content'] = block_example_contents($delta);
            break;
        case 'example_uppercase':
            $block['subject'] = t("uppercase this please");
            $block['content'] = t("This block's title will be changed to uppercase. Any other block with 'uppercase' in the subject or title will also be altered. If you change this block's title through the UI to omit the word 'uppercase', it will still be altered to uppercase as the subject key has not been changed.");
            break;
    }
    return $block;
}