You are here

function mylivechat_block in My Live Chat 6

File

./mylivechat.module, line 30

Code

function mylivechat_block($op = 'list', $delta = '', $edit = array()) {
  $mylivechat = mylivechat::get_instance();

  // 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['live-chat-display'] = array(
        'info' => t('MyLiveChat'),
      );

      // A block can provide default settings. In this case we'll enable the
      // block and make it visible only on the 'node/*' pages.
      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.
      switch ($delta) {
        case 'live-chat-display':

          // The content of the block is typically generated by calling a custom
          // function.
          $block['content'] = $mylivechat
            ->getChatCode();
          break;
      }
      return $block;
  }
}