0

Possible Duplicate:
Block not showing up in drupal

For some odd reason, This very simple module block does not show up in structure under the list of viable blocks. Am I doing something wrong here?

[quick_links.info]

name= Quick Links
description = Simple block with links
package = Mpackage
core = 7.x
files[] = quick_links.module



[quick_links.module]

function quick_links_block_info() {
  $blocks['quick_links_staff'] = array(
    'info' => t('Quick Link'),
    'status' => 1,
  );
  return $blocks;
}//TODO add caching option

function quick_links_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'quick_links_staff' :
      $block['subject'] = t('Quick Link');
      $block['content'] = t('links go here');
      break;
  }
  return $block;
}

marked as duplicate by Chapabu, mpdonadio Nov 21 '12 at 23:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I don't have a real explanation why my solution worked; I only replaced quick_links_staff with quick_links in both places.

function quick_links_block_info() {
  $blocks['quick_links'] = array(
    'info' => t('Quick Link'),
    'status' => 1,
  );
  return $blocks;
}//TODO add caching option

function quick_links_block_view($delta = '') {
  $block = array();
  switch ($delta) {
  case 'quick_links':
    $block['subject'] = t('Quick Link');
    $block['content'] = t('links go here');
    break;
  }
  return $block;
}

Make sure to clear Drupal cache after you implement the change.

  • The code shown from the OP should work; changing the block delta is not what should make the difference. Probably, the OP didn't clear the cache, and edited an already enabled module. – kiamlaluno Nov 28 '12 at 7:06
  • I agree with you @kiamlaluno, but before I posted my answer I tried use the same block delta "quick_links_staff" and cleared Drupal cache using drush and I also, disabled the module and enabled it again after the first enable. have you tried it? – Aboodred1 Nov 28 '12 at 15:52
  • Drupal doesn't have restrictions for the values $delta can assume. Using quick_links_staff, or quick_links doesn't make any difference, for Drupal. If quick_links works, but quick_links_staff doesn't, the reason is another one. – kiamlaluno Nov 28 '12 at 16:10
  • I have updated my code and cleared the cache a million times. I can create a block in any other module, but this one is still not working. I can see the module in my list of modules, but no block shows up when the module is enabled. I'm quite confused at this point ~:-( – mannadu Nov 28 '12 at 20:02

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