0

The custom module is called, "epic_module". It defines several blocks, say "awesome_block" and "epic_block".

function epic_module_block_info() {
  $blocks['awesome_block'] = array(
    'info' => t('Awesome block'),
    'cache' => DRUPAL_NO_CACHE,
  );

  $blocks['epic_block'] = array(
    'info' => t('Epic Block'),
    'cache' => DRUPAL_NO_CACHE,
  );

  return $blocks;
}

function epic_module_block_view($delta = '') {
  $block = array();

  switch ($delta) {
    case 'awesome_block':
      // TO-DO: Set $block['content'], etc...
      break;
    case 'epic_block':
      // TO-DO: Set $block['content'], etc...
      break;
  }
  return $block;
}

I have also created a templates directory under my module's directory.

I'm confused by the naming conventions. I want to link the template files for the specified blocks.

0

If you want to use a different template file for your blocks, by default Drupal uses the following template files.

  • block--epic-module.tpl.php for all the blocks implemented by the module you are showing

  • block--epic-module--awesome-block.tpl.php and block--epic-module--epic-block.tpl.php for the blocks implemented by that code

Keep in mind that each underscore in the module name or in the block name (i.e. what the documentation calls delta) is replaced with a hyphen.

Reference

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.