You are here

function document_block in Document 6

Implementation of hook_block().

File

./document.module, line 444

Code

function document_block($op = 'list', $delta = '', $edit = array()) {

  // The $op parameter determines what piece of information is being requested.
  switch ($op) {
    case 'list':

      // If $op is "list", we just need to return a list of block descriptions.
      // This is used to provide a list of possible blocks to the administrator;
      // end users will not see these descriptions.
      $blocks['document-search-block1'] = array(
        'info' => t('Document Search by author, keywords or type (radio selection)'),
      );
      $blocks['document-search-block2'] = array(
        'info' => t('Document Search by author, keywords or type (drop down type selection)'),
      );
      return $blocks;
    case 'view':

      // If $op is "view", then we need to generate the block for display
      // purposes. The $delta parameter tells us which block is being requested.
      drupal_add_css(drupal_get_path('module', 'document') . '/document.css');
      switch ($delta) {
        case 'document-search-block1':
          $block['subject'] = t('');
          $block['content'] = drupal_get_form('document_block1_form');
          return $block;
        case 'document-search-block2':
          $block['subject'] = t('');
          $block['content'] = drupal_get_form('document_block2_form');
          return $block;
      }
  }
}