1

Relatively new to Drupal. I have created a custom Module that is supposed to create a block. I refferenced a successful module that accomplished the same end goal (implementing a custom HTML build).

I have done the "Disable > Delete > Clear Cache > Re-Install/Activate Module" process a few times, with no luck. Any help or insight would be appreciated!

Here is my code for the .info file:

name = History of Alcohol Timeline
core = 7.x
package = Legal Thinking Age
php = 5.2.4
version = 7.x-1.0
project = lta_hoa

Here is my code for the module:

<?php

function lta_hoa_timeline() {

$output = <<<TIMELINE

  ...


TIMELINE;

return $output;

}

function lta_hoa_block_info() {

  $blocks['lta_hoa'] = array(
            'info' => t('History of Alcohol')
        );

  return $blocks;

}

function lta_hoa_block_view($delta = ''){

  // Setup blocks
    $block = array();
    switch ($delta) {
      case 'lta_hoa':
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/jquery.fancybox.css');
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/media-queries.css');
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/style.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/jquery.fancybox.pack.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/jquery.timelinr-0.9.53.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/lta_hoa.js');
      $block = array(
          'subject' => t('History of Alcohol'),
          'content' => lta_hoa_timeline()
        );
        break;
        default:
          break;
    }

    return $block;
}
  • Hello and welcome. First, this site is not a free support service. Any help or insight would be appreciated! is false - we are questions and answers community. This is not a forum, and that's exactly what keeps many of us here. Second, what does it mean "not showing" in your case? On the block list in admin? On the page? What if you switch to other theme? What have you tried to debug it on your own? – Mołot May 22 '14 at 20:50
0

Code looks fine to me, except for the sometimes funky indenting :)

Your function lta_hoa_timeline() just returns ... in example code. If your actual code contains a whole of stuff instead of ... and you have trouble getting that to work/display, it might have something to do with the inclusion of CSS/JS files. At the very least you should see the title of the block appear. But if ... is your actual returned content, it should work.

Verify that you've put your block in a region, that your theme displays that specific region, and that your block is not restricted to any specific page/role/.. , and you should see your block. As suggested above, switch to a default theme, put block in a standard region like sidebar left, and turn off all restrictions

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.