GoodSp33d
GoodSp33d

Reputation: 6282

How to add custom blocks in drupal?

I have a simple module which will return a form , but now i have added this to a menu like admin/settings/ But i want this form in another page ,so i added a hook_block() , my module showed up in the blocks page and i added it to be seen by all in all pages in content area but i dont get that form ? where did i go wrong ? I am new to drupal any help plz

function emp_form_block($op = 'list', $delta = 0, $edit = array()) {
     switch ($op) {
          case 'list':
          $blocks[0]['info'] = t('New Block');
          $blocks[0]['cache'] = BLOCK_NO_CACHE;
          return $blocks;
     }
}

i am using drupal 6

Upvotes: 0

Views: 244

Answers (1)

tamasd
tamasd

Reputation: 5923

You should also implement the view op, like this:

case 'view':
  return array(
    'subject' => t('My awesome form'),
    'content' => drupal_get_form('my_awesome_form'),
  );
  break;

Upvotes: 1

Related Questions